(n-1)th power map is endomorphism taking values in the center implies nth power map is endomorphism

Statement
Suppose $$G$$ is a group and $$n$$ is an integer such that the power map $$x \mapsto x^{n-1}$$ is an endomorphism of $$G$$ and $$x^{n-1}$$ is in the center of $$G$$ for all $$x$$ in $$G$$. Then, the map $$x \mapsto x^n$$ is also an endomorphism of $$G$$.

Applications

 * Frattini-in-center odd-order p-group implies (mp plus 1)-power map is automorphism

Converse
The precise converse is not true, but a partial converse is: nth power map is surjective endomorphism implies (n-1)th power map is endomorphism taking values in the center

Proof
Given: A group $$G$$, an integer $$n$$ such that the map $$x \mapsto x^{n-1}$$ is an endomorphism taking values in the center.

To prove: The map $$x \mapsto x^n$$ is an endomorphism of $$G$$, i.e., $$(gh)^n = g^nh^n$$ for all $$g,h \in G$$.

Proof: We have the following for all $$g,h \in G$$.