The primary work of dams is to store water as a reservoir.
Since it is known that water stored at heights has higher potential energy; the higher the height the higher the potential energy. This potential energy is required to generate hydroelectric power.
Hence, the dams are constructed at greater heights.