Let $M$ be a maximal subgroup of a $p$-group $G$. For fixed $g\in G\backslash M$ and $z\in Z(G)\cap M$ of order $p$, the map \begin{align*} \alpha : G&\longrightarrow G\\ mg^i &\longmapsto mg^iz^i \end{align*} is an automorphism of $G$.
Suppose that $M$ is a proper subgroup of $G$. Then $M$ is normal and has index $p$. This means that $$G=\bigcup_{i=0}^{p-1} Mg^i$$ where $Mg^i\cap Mg^j=\phi$ for $i\neq j$.
Note that
\begin{align*}
\textrm{Ker } \alpha &=\{x\in G \;|\;\alpha(x)=1\}\\
&=\{mg^i\in G\;|\; \alpha(mg^i)=1\}\\
&=\{mg^i\in G\;|\; mg^iz^i=1\}\\
&=\{mg^i\in G \;|\; m=1,\; i=0\}\\
&=1
\end{align*}
This implies that $\alpha$ is 1-1.
Since $G$ is finite and $\alpha$ maps $G$ to $G$ and $\alpha$ is 1-1, we can say that $\alpha$ is onto.
Combining the facts above, we conclude that $\alpha$ is bijective.
Now the problem i have is to prove that it is a homomorphism.
For $x,y\in G$, write $x=mg^i,y=ng^j$ where $m,n\in M$. How can I show that $$xy=mg^ing^j=mng^{i+j}$$
Is it $g$ commutes with elements in $M$?
(Updated idea)
$xy=m'g^{i+j}$ for some $m'\in M$. So we have \begin{align*}
\alpha(xy)&=\alpha(m'g^{i+j})\\
&=m'g^{i+j}z^{i+j}\\
&=m'g^iz^ig^jz^j\\
&=mg^iz^ing^jz^j\\
&=\alpha(x)\alpha(y)
\end{align*}