This answer assumes the following theorem, so if it's not something you feel you can use you'll need to prove it first:
If $f_1,g_1\colon X\to Y$ are homotopic, and $f_2,g_2\colon Y\to Z$ are homotopic, then the compositions $f_2\circ f_1$ and $g_2\circ g_1$ are also homotopic.
Assuming this theorem, we show that if $fg\backsimeq1$ and $hf\backsimeq1$ then $g\backsimeq h$, so $1\backsimeq fg\backsimeq fh$ and $f$ is by definition a homotopy equivalence (with inverse homotopy equivalence $h$). To do this, we use the above theorem and the associativity of composition to find:
$$h=h\circ 1\backsimeq h(fg)=(hf)g\backsimeq 1\circ g=g$$
So $g\backsimeq h$ and we have the result as above.