If we initially take into account the fact that $G/Z$ is cyclic, then I know how to prove that $G$ is abelian. However I wanted an alternate proof which starts by assuming that $G/Z$ is abelian(which is true since it is cyclic) and then it proceeds to prove this result. We would eventually need to consider that $G/Z$ is cyclic (because being only abelian is not sufficient to arrive at result) but I could not figure out how to bring this in.
Here's what I did:
Since $G/Z$ is abelian,
$$Za Zb=Zb Za$$ for some $a,b \in G.$ Since $Z$ is a normal subgroup as well so left cosets are same as right cosets. $$\therefore ZZab=ZZba$$ Thus we have finally, $$Zab=Zba$$
Please keep the proof same till here and show that $ab=ba$.