The strategy is to express arbitrary elements $g, h \in G$ in terms of a generator of $G/Z(G)$ and central elements, then use the fact that central elements commute with everything.
**Step 1: Write elements in terms of the generator.**
Let $Z = Z(G)$. By hypothesis, $G/Z = \langle yZ \rangle$ for some $y \in G$. Let $g, h \in G$. Since every coset is a power of $yZ$:
\begin{align*}
gZ = (yZ)^i = y^i Z \quad \text{for some } i \in \mathbb{Z}.
\end{align*}
So $g = y^i z_1$ for some $z_1 \in Z$. Similarly, $h = y^j z_2$ for some $j \in \mathbb{Z}$ and $z_2 \in Z$.
**Step 2: Compute $gh$ and $hg$.**
Since $z_1, z_2 \in Z(G)$, they commute with every element of $G$. Therefore:
\begin{align*}
gh &= y^i z_1 \cdot y^j z_2 = y^i y^j z_1 z_2 = y^{i+j} z_1 z_2, \\
hg &= y^j z_2 \cdot y^i z_1 = y^j y^i z_2 z_1 = y^{i+j} z_1 z_2.
\end{align*}
**Step 3: Conclude.**
Since $gh = y^{i+j} z_1 z_2 = hg$ for all $g, h \in G$, the [group](/page/Group) $G$ is abelian.