$(\Bbb Z\oplus\Bbb Z_d)/\Bbb Z\simeq\Bbb Z_n$ then $d\mid n$ I'm in the middle of proving Hatcher 2.1.14

Determine which abelian groups $A$ fits into a short exact sequence $0\to\Bbb Z\to A\to\Bbb Z_n\to 0$ ?

I already showed that if $A = \Bbb Z\oplus\Bbb Z_d$ where $d\mid n$ then the the sequence is exact. Also if the given sequence is exact, then $A\simeq \Bbb Z\oplus\Bbb Z_d$ for some $d$. But I'm stuck proving $d\mid n$. I tried to use $(\Bbb Z\oplus\Bbb Z_d)/\Bbb Z\simeq\Bbb Z_n$ to show $d\mid n$, but how can I use it?
Edit: Let $0\to \Bbb Z\xrightarrow{f} A\xrightarrow{g}\Bbb Z_n\to 0$ be an exact sequence. Let $f(1)=\alpha$ and $g(\beta) =1$. I claim that $\alpha,\beta$ generates $A$. Let $x\in A$. If $x\in\operatorname{Im}(f)$ then $x$ is a multiple of $\alpha$. If $x\notin\operatorname{Im}(f)$ then by exactness, $x\notin\operatorname{Ker}(g)$ so $g(x) \neq 0$ so $g(x) = tg(\beta)$ for some $t$. Hence, $x-t\beta\in\operatorname{Ker}(g)=\operatorname{Im}(f)$ so $x =t\beta+t'\alpha$. Now by the fundamental theorem of finitely generated abelian group, $A\simeq \Bbb Z^l\oplus\Bbb Z_{m_1}\oplus\cdots\Bbb Z_{m_n}$ such that $m_1\mid m_2\mid\cdots \mid m_n$. Since $\Bbb Z$ is embedded in $A$, $l\geq 1$ and $A$ is generated by $\alpha,\beta$, $A\simeq\Bbb Z^2$ or $\simeq\Bbb Z\oplus\Bbb Z_d$ for some $d$. If $A\simeq\Bbb Z^2$ then $\Bbb Z^2/\Bbb Z\simeq \Bbb Z\neq\Bbb Z_n$ which is a contradiction (But from now, I think the argument is wrong).
If $A = \Bbb Z\oplus \Bbb Z_d$ where $d\mid n$ then define a map $f:\Bbb Z\to A$ by $t\mapsto (qt,[t])$ where $q = n/d$. And define a map $g:A\to\Bbb Z_n$ by $(x,[y])\mapsto [x-yq]$. Then this map is well defined group homomorphism. Clearly $g\circ f =0$. Let $(x,[y])\in\operatorname{Ker}(g)$ then $g(x,[y]) =[x-yq] =0$ so $x-yq = tn$ for some $t$. Hence, $x = q(td+y)$. Now $f(td+y) = (x,[y])$ which shows the exactness. The fact that $f$ is injective and $g$ is surjective is easy.
 A: As noted in the comments, you are rather loose with your notation. That's not a good thing.

The first part assumes $n,d\gt 0$, which you seem to be doing implicitly in your post. Below I deal with the possibility that one or both are zero.
Let $A=\mathbb{Z}\oplus\mathbb{Z}_d$, and let $N$ be a cyclic subgroup such that $A/N$ is finite cyclic of order $n$. Let $(x,y)$ be a generator for $N$.
Let $k=\gcd(d,n)$; then the image of $(0,1)$ has order dividing $k$, hence $(0,k)\in N$. Thus there exists $m\in\mathbb{Z}$ such that $m(x,y) = (0,k)$, hence $(mx,my)=(0,k)$. Thus, $mx=0$ and $my\equiv k\pmod{d}$.
Since $mx=0$, then either $x=0$ or $m=0$. If $x=0$, then $(r,0)\notin N$ for all $r\neq 0$, so $A/N$ has infinite order, which is impossible. Thus, $m=0$; hence $(0,0)=(0,k)$, so $k\equiv 0\pmod{d}$. Thus, $k=\gcd(d,n)\equiv 0\pmod{d}$, so $d=\gcd(d,n)$.

Here's another way, which also excludes the possibility $A=\mathbb{Z}\oplus\mathbb{Z}$ that you mention in the comments.  The key observation is:

If $N$ is cyclic (written additively) and $x,y\in N$ are both nontrivial, then there exist $r,s\in\mathbb{Z}$, both nonzero, such that $rx=sy$.

Suppose $n\gt 0$.  If $A=\mathbb{Z}\oplus\mathbb{Z}_d$ and $N$ be as above, with $d\geq 0$ (where $\mathbb{Z}_0$ means $\mathbb{Z}$). Let $k=\gcd(d,n)$, as above. Since both $(1,0)$ and $(0,1)$ have images of order dividing $n$, then $(n,0)$ and $(0,k)$ are both in $N$. (Note that $\gcd(0,n)=n$, so $k\neq 0$).
Since $N$ is cyclic, if $(0,k)\neq (0,0)$, then there must exist nonzero integers $r$ and $s$ such that $r(n,0)=s(0,k)$. But this forces $r=0$, which is impossible. Thus, it must be the case that $(0,k)=(0,0)$, so $d|k$. This excludes $d=0$ (since that would force $k=0$), and also proves that $\gcd(d,n)=d$, as required.

What if $n=0$? Then we must have $d=0$ in your initial setting, where $N$ is assumed to be infinite cyclic. Because $\mathbb{Z}$ is free abelian, hence projective, so the surjection $\mathbb{Z}\oplus\mathbb{Z}_d\to\mathbb{Z}$ splits. If the kernel is infinite cylic, that would mean that $\mathbb{Z}\oplus\mathbb{Z}_d\cong \mathbb{Z}\oplus N \cong \mathbb{Z}\oplus\mathbb{Z}$. Therefore the rank of $\mathbb{Z}\oplus\mathbb{Z}_d$ is two, so $\mathbb{Z}_d\cong\mathbb{Z}$ and hence $d=0$. Then $d=n=0$, so $d|n$ still holds.
