There is no requirement that the homomorphism be surjective....
The whole point of the problem is that: o(h)|n. If this were NOT so, we would have hn ≠ e, in which case:
φ(e) = φ(xn) = φ(x)n = hn ≠ e, so φ is not a homomorphism (which must map identity to identity).
Homomorphisms are just certain functions between groups, the image of a homomorphism does NOT have to be the entire target group.