$g_m$ is in general not even continuous. But it is bounded and has compact support, and that makes it easy to check that for any $\varphi \in C_c^\infty(\mathbb{R})$ with $\int \varphi = 1$, you have
$$\begin{align}(\varphi_\varepsilon \ast g_m)(x) &= \int_\mathbb{R} \frac{1}{\varepsilon}\varphi\left(\frac{z}{\varepsilon}\right) g_m(x-z)\,dz\\
&=\int_\mathbb{R} \varphi(y)g_m(x-\varepsilon y)\,dy \xrightarrow{\varepsilon\to 0} g_m\tag{1}
\end{align}$$
both in $L^1$ and in $L^2$. The family $\left\lbrace \varphi_\varepsilon : \varepsilon > 0 \right\rbrace$, where $\varphi_\varepsilon(x) := \varepsilon^{-1}(x/\varepsilon)$, is called an approximation of the identity (because $\lim\limits_{\varepsilon\to 0} \varphi_\varepsilon \ast h = h$ for $h \in L^p$ [and other reasonable function spaces], so convolution with $\varphi_\varepsilon$ is approximately the identity operation for small $\varepsilon > 0$).
Since $g_m$ and $\varphi$ have compact support, the support of $g_m$ is contained in $[-m,m]$, and the support of $\varphi$ say is contained in $[-K,K]$, the support of $\varphi_\varepsilon\ast g_m$ is contained in $[-(m+\varepsilon K), m+\varepsilon K]$, hence compact. Writing the convolution integral in the form
$$(\varphi_\varepsilon \ast g)(x) = \frac{1}{\varepsilon}\int_\mathbb{R} \varphi\left(\frac{x-z}{\varepsilon} \right)g_m(z)\,dz,$$
the dominated convergence theorem shows that $\varphi_\varepsilon \ast g_m$ is differentiable with
$$(\varphi_\varepsilon \ast g)'(x) = \frac{1}{\varepsilon^2}\int_\mathbb{R} \varphi'\left(\frac{x-z}{\varepsilon} \right)g_m(z)\,dz,$$
and iterating the argument shows that $\varphi_\varepsilon \ast g_m \in C^\infty(\mathbb{R})$.
And thus, to obtain a sequence in $\mathscr{S}(\mathbb{R})$ converging to $f$ in both $L^1$ and $L^2$, for every $n \in\mathbb{Z}^+$, choose an $m$ such that $\lVert g_m-g\rVert_p < \frac{1}{2n}$ for $p\in \{1,2\}$, and then choose $\varepsilon$ in $(1)$ small enough that you have $\lVert (\varphi_\varepsilon \ast g_m) - g_m\rVert_p < \frac{1}{2n}$ for $p\in\{1,2\}$.
Since for all $m$ and $\varepsilon > 0$ we have $\varphi_\varepsilon \ast g_m \in C_c^\infty(\mathbb{R}) \subset \mathscr{S}(\mathbb{R})$, the so-constructed sequence converges of Schwartz functions converges to $f$ simultaneously in $L^1$ and $L^2$.