$$T = t_1 + t_2 = \frac{\sqrt{160^2 + h^2}}{40} + \frac{\sqrt{65^2 + (60-h)^2}}{112}$$
Take derivative of $T$ with respect to $h$, set to zero to find optimizing $h$.
Answer: $h = 26.52 m,$ measured from the top.
(If you're clever, you could use Snell's Law!)
* * *
Your error was in just computing the _distance_. Instead, you are to minimize _time_ , and the total time consists of two portions. The _sum_ of these two times must be minimized.