I wish to show that
The abelian groups $\mathbb Q/\mathbb Z$ and $\mathbb R/\mathbb Z$ are injective cogenerators for the category $\mathbb{Z}\textbf{-Mod}$.
Recall that
An object $E$ in a category $\mathscr C$ is said to be a cogenerator of $\mathscr C$ if for any $f,g: X\to Y$, if $f\ne g$, then there exists $h: Y\to E$ such that $hf\ne hg$.
and
An object ${\displaystyle Q}$ in a category ${\displaystyle \mathscr {C}}$ is said to be injective if for every monomorphism ${\displaystyle f:X\to Y}$ and every morphism ${\displaystyle g:X\to Q}$ there exists a morphism ${\displaystyle h:Y\to Q}$ extending ${\displaystyle g}$ to ${\displaystyle Y}$, i.e. such that ${\displaystyle h\circ f=g}$.
First, let us work with $\mathbb Q/\mathbb Z$, and hopefully, the proof for $\mathbb R/\mathbb Z$ will be similar. Note that injective objects in $\mathbb{Z}\textbf{-Mod}$ are just the injective modules. Are $\mathbb Q/\mathbb Z$ and $\mathbb R/\mathbb Z$ injective $\Bbb Z$-modules?
Further, to show that $\mathbb Q/\mathbb Z$ is a cogenerator in $\mathbb{Z}\textbf{-Mod}$, suppose $f,g: X\to Y$ where $f\ne g$. How should I construct an $h: Y\to \Bbb Q/\Bbb Z$ such that $hf\ne hg$?
At this point, I'm very new to these definitions, and I'm unable to use them well. I'd appreciate any help and clarifications! I've also edited my question to focus it to $\mathbb{Z}\textbf{-Mod}$ instead of $\textbf{Ab}$, which is an isomorphic category (see @Mindlack's comments).
Let me try to give you a detailed proof. I will assume the following well-known facts about $\mathbb Z$:
I will also need the following well-known fact (of which I'm including an almost complete proof):
BAER'S CRITERION (for PIDs): Let $R$ be a PID. An $R$-module $E$ is injective if and only if it is divisible, that is, if and only if, for all $0\neq r\in R$ and $e\in E$, there is $e'\in E$ such that $re'=e$.
Proof (sketch). If $E$ is injective, let $e\in E$ and $0\neq r\in R$. Then, there is a homomorphism $\phi\colon rR\to E$ mapping $rs\mapsto se$, for all $s\in R$. Consider now the obvious inclusion $rR\hookrightarrow R$ and, using injectivity, extend $\phi$ to a morphism $\phi'\colon R\to E$ such that $\phi'_{\restriction rR}=\phi$. Then, letting $e':=\phi'(1_R)$, we have that $$re'=r\phi'(1_R)=\phi'(r\cdot 1_R)=\phi(r\cdot 1_R)=1_R\cdot e=e,$$ showing that $E$ is divisible. For the converse, let $Y$ be an $R$-module and $X\leq Y$ a submodule. By transfinite induction one can construct a sequence $(X_\alpha)_{\alpha<\sigma}$ for some ordinal $\sigma$, with the following properties:
(P1) $X_0=X$, $X_\alpha<X_\beta\leq Y$ for all $\alpha<\beta<\sigma$, and $\bigcup_{\alpha<\sigma}X_\alpha=Y$;
(P2) if $\alpha<\alpha+1<\sigma$, then $X_{\alpha+1}=X_\alpha+Rx_\alpha$ for some $x_\alpha\in X_{\alpha+1}$;
(P3) if $\lambda<\sigma$ is a limit ordinal, then $X_\lambda=\bigcup_{\alpha<\lambda}X_\alpha$.
Suppose now that $E$ is divisible and take a morphism $\phi\colon X\to E$. To extend $\phi$ to a morphism $Y\to E$ one can proceed inductively: if $\alpha=0$, then $X_0=X$ and $\phi_0:=\phi$. If $\alpha<\alpha+1<\sigma$ and we already have $\phi_\alpha\colon X_\alpha\to E$, choose $x_\alpha\in X_{\alpha+1}$ such that $X_{\alpha+1}=X_\alpha+Rx_\alpha$ and verify that $I:=\{r\in R:rx_\alpha\in X_\alpha\}\leq R$ is an ideal, so that $I=s_\alpha R$ for some $s_\alpha\in R$ as $R$ is a PID. As $E$ is divisible, there is $e_\alpha\in E$ such that $s_\alpha e_\alpha=\phi_\alpha(s_\alpha x_\alpha)$ (in case $s_\alpha=0$, just take $e_\alpha=0$). One checks that $\phi_{\alpha+1}\colon X_{\alpha+1}\to E$ such that $\phi_{\alpha+1}(x+rx_\alpha):=\phi_\alpha(x)+re_\alpha$ is a well-defined homomorphism such that $(\phi_{\alpha+1})_{\restriction X_\alpha}=\phi_\alpha$. If $\lambda<\sigma$ is a limit, define $\phi_\lambda\colon X_\lambda\to E$ as $\phi_\lambda(x):=\phi_\alpha(x)$, where $\alpha<\lambda$ is the smallest ordinal for which $x\in X_\alpha\leq X_\lambda$; one checks that $\phi_\lambda$ is a well-defined homomorphism such that $(\phi_\lambda)_{\restriction X_\alpha}=\phi_\alpha$ for all $\alpha<\lambda$.
Finally, define a function $\psi\colon Y\to E$ as $\psi(y):=\phi_\alpha(y)$, where $\alpha<\sigma$ is the smallest ordinal for which $y\in X_\alpha$. To conclude one just needs to check that $\psi$ is a well-defined homomorphism: it is then clear by construction that $\psi_{\restriction X}=\phi$, as desired.\\\
As a consequence of the above result, one gets:
COROLLARY: Let $R$ be a PID. Then the following statements hold true:
(1) If $E$ is an injective $R$-module and $K\leq E$, the $E/K$ is injective (that is, quotients of injectives are injective);
(2) If $\{E_i:i\in I\}$ is a (possibly infinite) family of injectives, then $\bigoplus_IE_i$ is injective (direct sum of injectives is injectives).
Proof. (1): We have to show that $E/K$ is divisible. Indeed, given $e\in E$ and $0\neq r\in R$, use the divisibility of $E$ to get $e'\in E$ such that $re'=e$. This shows that, in $E/K$, $r\cdot (e'+K)=e+K$.
(2): We have to show that $\bigoplus_IE_i$ is divisible. Indeed, given $(e_i)_I\in \bigoplus_IE_i$ and $0\neq r\in R$, use, for each $i\in I$, the divisibility of $E_i$ to get $e_i'\in E_i$ such that $re_i'=e_i$. This shows that, in $\bigoplus_IE_i$, $r\cdot (e'_i)_I=(re_i')_I=(e_i)_I$.\\\
Specializing the above result to $R=\mathbb Z$, we obtain the following:
COROLLARY: An Abelian group $E$ (that is, a $\mathbb Z$-module), is injective if and only if it is divisible. In particular, $E$ is injective if and only if, for all $0\neq n\in \mathbb Z$ and $e\in E$, there exists $e'\in E$ such that $ne'=e$. Furthermore, the class of injective Abelian groups is closed under arbitrary quotients and direct sums.
Using the above description of the injective Abelian groups, we can easily deduce that both $\mathbb Q/\mathbb Z$ and $\mathbb R/\mathbb Z$ are injective:
EXAMPLE: The following are examples of injective Abelian groups:
We now know all we need to known about injective Abelian groups and we can turn our attention to those injectives that are also cogenerators:
PROPOSITION: The following are equivalent for an injective Abelian group $E$:
(1) $E$ is a cogenerator;
(2) $\mathrm{Hom}(X,E)\neq 0$, whenever $X$ is a non-trivial Abelian group;
(3) $\mathrm{Hom}(\mathbb Z/n\mathbb Z,E)\neq 0$, for all $0\neq n\in \mathbb Z$, and $\mathrm{Hom}(\mathbb Z,E)\neq 0$;
(4) $\mathrm{Hom}(\mathbb Z(p),E)\neq 0$, for each prime $p\in \mathbb Z$;
(5) $\mathbb Z(p)\leq E$ for all $p\in \mathbb Z$ prime.
Proof. The implications ''(2)$\Rightarrow$(3)$\Rightarrow$(4)'' and ''(5)$\Rightarrow$(4)'' are trivial.
(1)$\Rightarrow$(2): If $X\neq 0$, then $\mathrm{id}_X\neq 0\colon X\rightrightarrows X$. Therefore, by definition of cogenerator, there exists $h\in \mathrm{Hom}(X,E)$ such that $h=h\circ \mathrm{id}_X\neq h\circ 0=0$. Hence, $\mathrm{Hom}(X,E)\neq 0$.
(4)$\Rightarrow$(5): note that any non-trivial homomorphism $f\colon\mathbb Z(p)\to E$ is injective. In fact, as $\mathbb Z(p)$ is simple, either $\mathrm{Ker}(f)=0$ or $\mathrm{Ker}(f)=\mathbb Z(p)$. As the latter option is excluded (because we have assumed that $f$ is non-trivial), we deduce that $\mathrm{Ker}(f)=0$, that is, $f$ is injective. But then, $\mathrm{Im}(f)\cong \mathbb Z(p)$ is a subgroup of $E$, as desired.
(5)$\Rightarrow$(3): given a positive integer $n$, write $n=p_1^{a_1}\cdot \ldots\cdot p_n^{a_n}$, where $p_1,\dots,p_n$ are distinct primes and $a_1,\dots, a_n$ are non-zero positive integers. Then, $n\mathbb Z\subseteq p_1\mathbb Z$ and, therefore, there is a non-trivial morphism $f\colon \mathbb Z/n\mathbb Z\to \mathbb Z(p_1)$ that sends $x+n\mathbb Z\mapsto x+p_1\mathbb Z$ (e.g., use the Third Isomorphism Theorem to deduce that $\mathbb Z(p_1)\cong(\mathbb Z/n\mathbb Z)/(p_1\mathbb Z/n\mathbb Z)$ is a quotient of $\mathbb Z/n\mathbb Z$, where $f$ is the canonical projection onto the quotient). Composing $f$ with the inclusion $\iota_{p_1}\colon\mathbb Z(p_1)\to E$, we deduce that $\mathrm{Hom}(\mathbb Z(n),E)\neq 0$ since it contains $\iota_{p_1}\circ f\neq 0$. Finally, to show that $\mathrm{Hom}(\mathbb Z,E)\neq 0$ just take a prime $p$, then the obvious projection $\pi_p\colon\mathbb Z\to \mathbb Z(p)$ is non-trivial, so $\iota_p\circ\pi_p\colon \mathbb Z\to E$ is non-trivial.
(3)$\Rightarrow$(2): Let $X$ be a non-trivial Abelian group, that is, there is $x\in X$ such that $x\neq 0$. Consider the subgroup $\mathbb Zx:=\{nx:n\in \mathbb Z\}\leq X$ generated by $x$ in $X$. The canonical group homomorphism $\pi_x\colon \mathbb Z\to \mathbb Zx$, sending $n\mapsto nx$ is clearly surjective and so $\mathbb Zx\cong \mathbb Z/\mathrm{Ker}(\pi_x)$ (by the First Isomorphism Theorem). In particular, as $\mathrm{Ker}(\pi_x)$ is a subgroup of $\mathbb Z$, we have that either $\mathrm{Ker}(\pi_x)=0$ or $\mathrm{Ker}(\pi_x)=n\mathbb Z$ for some $0\neq n\in \mathbb Z$. In the former case $\mathbb Zx\cong \mathbb Z$, while in the latter $\mathbb Zx\cong \mathbb Z/n\mathbb Z$. In either case, our hypothesis tells us that there is a non-trivial morphism $f\colon \mathbb Zx\to E$. Finally, since $E$ is injective, we can extend $f$ through the inclusion $\varepsilon_x\colon \mathbb Zx\to X$ to get a non-trivial morphism $f'\colon X\to E$ such that $f'\circ \varepsilon_x=f$. In particular, $\mathrm{Hom}(X,E)\neq 0$, as desired.
(2)$\Rightarrow$(1): Let $f\neq g\colon X\rightrightarrows Y$ be two different homomorphisms of Abelian groups and let us find some $h\colon Y\to E$ such that $h\circ f\neq h\circ g$. Indeed, consider the morphism $f-g\colon X\to Y$, sending $x\mapsto f(x)-g(x)$ and identify $\bar X:=\mathrm{Im}(f-g)\cong X/\mathrm{Ker}(f-g)$ with a subgroup of $Y$. Note that, since $f\neq g$, we have that $\mathrm{Ker}(f-g)\neq X$ and, therefore, $0\neq \bar X\leq Y$. By (2), there is a non-trivial morphism $h'\colon \bar X\to E$ and, using the injectivity of $E$, we can extend $h'$ to a morphism $h\colon Y\to E$ such that $h\restriction_{\bar X}\ =h'$. Let us verify that $h\circ f\neq h\circ g$, indeed, choose $\bar x\in \bar X$ such that $h'(\bar x)\neq 0$ (it exists as $h'\neq 0$ by construction) and note that $\bar x= (f-g)(x)$ for some $x\in X$. Thus, $$ h(f(x))-h(g(x))=h((f-g)(x))=h(\bar x)=h'(\bar x)\neq 0 $$ so, in particular, $h(f(x))\neq h(g(x))$ and $h\circ f\neq h\circ g$.\\\
Note that we have the following easy corollary of the above characterization:
COROLLARY: Let $E$ be an injective cogenerator in $\mathrm{Mod}(\mathbb Z)$. If $E'$ is an injective Abelian group that contains $E$ as a subgroup, then also $E'$ is an injective cogenerator.
Proof. One can use the equivalent characterizations given in the above proposition, e.g., note that each simple $\mathbb Z(p)\leq E\leq E'$ is a subgroup of $E'$.\\\
In particular, as $\mathbb Q/\mathbb Z\leq \mathbb R/\mathbb Z$, if we can prove that $\mathbb Q/\mathbb Z$ is an injective cogenerator, then the above corollary tells us that also $\mathbb R/\mathbb Z$ is an injective cogenerator. Finally, to see that $\mathbb Q/\mathbb Z$ is an injective cogenerator, it is enough to find a copy of each simple $\mathbb Z(p)$ embedded in $\mathbb Q/\mathbb Z$. For this, just note that: $$ \mathbb Z(p)\cong\{n/p:n\in \mathbb Z\}/\mathbb Z\leq \mathbb Q/\mathbb Z $$ To show the above isomorphism, consider the following homomorphism of Abelian groups: $$ \pi_p:\mathbb Z\to \mathbb Q/\mathbb Z\quad\text{such that}\quad \pi_p(n):=n/p+\mathbb Z. $$ Clearly, the image of $\pi_p$ is a subgroup $\mathrm{Im}(\pi_p)\leq \mathbb Q/\mathbb Z$ and, by the First Isomorphism Theorem, this subgroup is isomorphic to $\mathbb Z/\mathrm{Ker}(\pi_p)$. To conclude, just note that $$ \mathrm{Ker}(\pi_p)=\{n\in \mathbb Z:\pi_p(n)=0\}=\{n\in \mathbb Z:n/p\in \mathbb Z\}=\{n\in \mathbb Z:p|n\}=p\mathbb Z. $$
This concludes the proof that $\mathbb Q/\mathbb Z$ and $\mathbb R/\mathbb Z$ are both injective cogenerators in the category of Abelian groups, so answering your question. Let me just add a couple of final observations:
(Obs.1) It is true for a general ring $R$ that a right $R$-module $E$ is an injective cogenerator if and only if $E$ is injective and it contains a copy of all the simple right $R$-modules;
(Obs.2) For a general ring $R$, and for a right $R$-module $M$, let $E(M)$ be the injective envelope of $M$ (this is an injective module that contains $M$ as a submodule and which is "minimal", in a sense that can be made precise, with respect to this property). Of course, if $E$ is an injective module and $M\leq E$, then $E(M)$ is a summand of $E$. Therefore, one can reformulate (Obs.1) by saying that an injective right $R$-module $E$ is a cogenerator if, and only if, $E(S)$ is a summand of $E$, for every simple right $R$-module $S$;
(Obs.3) One can improve even further the above observations as follows: let $R$ be a ring and let $\{S_i:i\in I\}$ be a family of representatives of the isomorphism classes of simple right $R$-modules (e.g., one can take $\{R/\mathbb m:\mathbb m\text{ maximal right ideal of $R$}\}$). Then, an injective right $R$-module $E$ is a cogenerator if and only if $E(\bigoplus_IS_i)$ is a summand of $E$. For this reason, the right $R$-modules isomorphic to $E(\bigoplus_IS_i)$ are said to be minimal injective cogenerators. Note in particular that any other injective cogenerator $E$ is of the form $E\cong E_{min}\oplus E'$, where $E_{min}$ is a minimal injective cogenerator and $E'$ is any injective right $R$-module;
(Obs.4) If $R$ is a right Noetherian ring, then infinite direct sums of injectives are injective and, in the notation of (Obs.3), it is not difficult to se that $E(\bigoplus_IS_i)\cong \bigoplus_IE(S_i)$, that is, for a right Noetherian ring the minimal injective cogenerators are just those modules which are isomorphic to the direct sum of the injective envelopes of the simples;
(Obs.5) If $R$ is a commutative Noetherian ring, let $\mathrm{Spec}(R)$ and $\mathrm{MSpec}(R)$ be the sets of prime and of maximal ideals of $R$, respectively. It is then known that an injective $R$-module $E$ can be written uniquely, up to isomorphism, as $E\cong \bigoplus_{\mathbb p\in \mathrm{Spec}(R)}E(R/\mathbb p)^{(I_{\mathbb p}(E))}$. In particular, such an $E$ is an injective cogenerator if and only if $I_{\mathbb p}(E)\neq \emptyset$ for all $\mathbb p\in \mathrm{MSpec}(R)$. Furthermore, $E$ is a minimal injective cogenerator if, and only if, $E\cong \bigoplus_{\mathbb m\in \mathrm{MSpec}(R)}E(R/\mathbb m)$.
Finally, specializing the above observations to $R=\mathbb Z$, and noting that $\mathbb Z$ is commutative Noetherian, one can use the above observations to obtain all the injective cogenerators (up to isomorphism):
COROLLARY: For each prime $p$, consider the following subgroup of $\mathbb Q/\mathbb Z$: $$ \mathbb Z(p^\infty):=\{m/p^n:m\in \mathbb Z,n\in \mathbb N\}/\mathbb Z\leq \mathbb Q/\mathbb Z. $$ Then, $\mathbb Z(p^\infty)$ is the injective envelope of the simple $\mathbb Z(p)$. Furthermore, $\mathbb Q/\mathbb Z\cong \bigoplus_{p}\mathbb Z(p^{\infty})$ is a minimal injective cogenerator in $\mathrm{Mod}(\mathbb Z)$.
In general, any injective Abelian group $E$ can be written uniquely as $$ E\cong \mathbb Q^{(I_{0}(E))}\oplus \bigoplus \mathbb Z(p^{\infty})^{(I_p(E))} $$ and $E$ is an injective cogenerator if and only if $I_p(E)\neq \emptyset$ for all $p$ prime.
Let me conclude with the following two examples:
To convince yourself that $\mathbb R$ (or $\mathbb Q$) is not a cogenerator in the category of Abelian groups (as claimed above), just take the two morphisms $0\colon \mathbb Z(p)\to \mathbb Z(p)$ and $\mathrm{id}_{\mathbb Z(p)}\colon \mathbb Z(p)\to \mathbb Z(p)$ for some prime $p$. Then, clearly $0\neq \mathrm{id}_{\mathbb Z(p)}$. On the other hand, $\mathrm{Hom}(\mathbb Z(p),\mathbb R)=0$ (and, for similar reasons, $\mathrm{Hom}(\mathbb Z(p),\mathbb Q)=0$), in fact, given a morphism $f\colon \mathbb Z(p)\to \mathbb R$, we have that $p x=0$ for all $x\in \mathrm{Im}(f)$ and, inside $\mathbb R$, $p x=0$ if and only if $x=0$, that is, $\mathrm{Im}(f)=0$, proving that the unique morphism $h\colon \mathbb Z(p)\to \mathbb R$ is the $0$-morphism $h=0$. But then,
$$ h\circ \mathrm{id}_{\mathbb Z(p)}=0=h\circ 0\qquad\text{ for all $h\in \mathrm{Hom}(\mathbb Z(p),\mathbb R)$}, $$ so that $\mathbb R$ (and, similarly, $\mathbb Q$) cannot be a cogenerator.