Proof that if group $G/Z(G)$ is cyclic, then $G$ is commutative [duplicate]

A problem with your attempt is that you seem to want to use only the fact that the inner automorphism group is abelian, but this does not suffice. There are nonabelian groups $G$ such that $G/Z(G)$ is abelian, like the group of symmetries of the square. Thus, it does not follow from $\gamma_{ab}=\gamma_{ba}$ that $ab=ba$.

So you need to use the hypothesis that $G/Z(G)$ has a single generator. Robin Chapman pointed out to you here what you can conclude from this, so I might as well quote him:

Each element of $G$ has the form $a^nz$ where $a$ is fixed and $z\in Z(G)$...