I can't tell -- your presentation is lacking in detail.
For example, your first four lines could have been:
Suppose x1 and x2 are elements of Y such that g(x1) = g(x2). Then,
f(g(x1)) = f(g(x2))
id_y(x1) = id_y(x2) (since fog = id_y)
x1 = x2
Therefore, g(x1) = g(x2) implies x1 = x2, and g is injective.
It still contains all of the same rigor, but it actually let's people know what you're trying to do! It says what types x1 and x2 have, it states your hypotheses, and states your conclusion.
Because your presentation is lacking those details, I can't even figure out what the rest of your proof is trying to do. What is h? How did you prove f^-1 exists? I -think- I have an idea what the last 2 or 3 lines are doing, but if I'm right, you're proving the converse of what you're supposed to prove!