Your proof is correct, but there is no reason to use contradiction here: it just makes the argument unnecessarily complicated. You’ve basically taken the natural direct proof and turned it into a proof by contradiction.
We know that $g\mid x$, so there is an integer $m$ such that $x=mg$. Similarly, there is an integer $n$ such that $y=ng$. But then $x-h=mg-ng=(m-n)g$, and $m-n$ is an integer.