It can be used to refer to a bad situation (as it does in the example sentence).
This is terrible; how on earth did it happen?
or a good situation
How on earth did you manage to earn £800 in one week?
do away with means remove/discard.
The sentence can be rephrased as
It's terrible that they removed a lovely old building and put a car park there instead.
I am not a teacher.
Student or Learner