I am aware that I need to show that given any $g_1,g_2$ in $S$ if $(o(g_1g_2^{-1}),m)=1$ then $S$ will be a subgroup of $G$.
Now let $o(g_1)=r,o(g_2)=s,o(g_1g_2^{-1})=t$. Since $G$ is abelian we have
$$\begin{align} (g_1g_2^{-1})^{rs}&=g_1^{rs}(g_2^{-1})^{rs}\\ &=(g_1^r)^s((g_2^s)^{-1})^r\\ &=e^s(e^{-1})^r\\ &=e^se^r. \end{align}$$
This implies that $t\mid rs$. Now we must show that $(t,m)=1$. I could not find a way to show this.
Any help here will be appreciated. Thanks in advance.
If $g,h\in S$, if $a=o(g)$ and $b=o(h)$, then $o(h^{-1})=b$ and (since $G$ is abelian)$$o(gh^{-1})\mid o(g)o(h^{-1})=ab.$$Since both $a$ and $b$ are coprime with $m$, then so is $ab$ and therefore then so is $o(gh^{-1})$. In fact, if $o(gh^{-1})$ and $m$ are not coprime, then there is a prime number $p$ such that $p\mid o(gh^{-1})$ and $p\mid m$. But$$p\mid o(gh^{-1})\implies p\mid ab\implies p\mid a\text{ or }p\mid b.$$But this is impossible, since $(a,m)=(b,m)=1$.