During loan approval a house is purchased for $202,000 and during this process it was appraised for $236,000 at closing where does the difference of the purchase price and appraisal go to?
Into the ethernet.

Into the buyer's equity, actually. Can get rid of PMI after 6 months if the value is retained and your down payment plus equity is sufficient for 20% down.
Nowhere. As long as the appraisal is at or more than the sale price it does not matter.

You simply got a good deal on the house.

That is kind of like if you have a textbook that sells for $40 at a used book store. You sell it to your friend for $30. The $10 he saved is irrelevant.
Pretty much in your pocket. The house is worth 236.000 and you paid 202.000. You saved 34,000 on it and some people even pay over appaised value. You did get a good deal.