The ruler of each sentence is the verb (here: zeigen and schaden). Every verb needs some mandatory complements, and most verbs also accept some optional complements.
One complement, that every verbs needs, is the subject. (There are exceptions, but they are very rare.) All other complements are objects.
Every verb defines on its own which object it needs. Verbs with similar meanings (like verbs of movement for example: gehen, schwimmen, fliegen, laufen) very often needs the same classes of objects, but its still the verbs who define this classes
The verb zeigen (to show) needs three mandatory complements (same numbers identify same parts of speech):
Jemand1 zeigt jemandem2 etwas3
(Somebody1 shows something3 to_somebody2)
Der_Makler1 zeigt dem_Kunden2 das_Haus3
- jemand1 (somebody1)
This is the subject. Who is showing?
Becasue it is the subject, it has to stand in nominative case
- jemandem2 (to somebody2)
This is another mandatory complement. It tells us to whom something is shown. In German this part of speech has to stand in dative case, because the verb zeigen needs the information "to whom?" in a dative object.
- etwas3 (something3)
What is shown? The verb zeigen needs this information "what?" in an accusative object.
The Verb schaden (to harm) is a little bit simpler, it needs only two mandatory complements:
Jemand1 schadet jemandem2
(Somebody1 harms somebody2)
Die_Säure1 schadet dem_Haus2
- jemand1 (somebody1)
This is the subject. Who is harming?
Becasue it is the subject, it has to stand in nominative case
- jemandem2 (somebody2)
This is another mandatory complement. It tells us who is harmed. In German this part of speech has to stand in dative case, because the verb schaden needs the information "who is harmed?" in a dative object.