Let $M$ a manifold of dimension $n$.
Let $g_\varepsilon:\mathbb R^n\longrightarrow \mathbb R$ s.t. $g_\varepsilon\in\mathcal C^\infty (\mathbb R^n)$ and $supp(g_\varepsilon)=[-\varepsilon,\varepsilon]^n.$
Let $\varphi: U\longrightarrow V$ an homeomorphism which is $\mathcal C^\infty (U)$ and with $U\subset M$ and $V\subset \mathbb R^n$ (in fact, $(U,\varphi)$ is a chart $\mathcal C^\infty $).
We suppose by the way that $\varphi(p)=0$ and $[-\varepsilon,\varepsilon]^n\subset V$. Why the function $$f(q)=\begin{cases}g_\varepsilon(\varphi(q))&q\in U\\ 0&q\notin U\end{cases}$$ is $\mathcal C^\infty (M)$.
I agree that $f$ is $\mathcal C^\infty (U)$, but I have problem to understand that it is on all $M$.
I would says that $g_\varepsilon(\varphi(q))=0$ when $q\in U\backslash \varphi^{-1}([-\varepsilon,\varepsilon])$, and thus it's $$\mathcal C^\infty \Big((U\backslash \varphi^{-1}([-\varepsilon,\varepsilon])\cup (M\backslash U)\Big) \quad \text{and it's}\quad \mathcal C^\infty \Big(\varphi^{-1}(-\varepsilon,\varepsilon)\cup (U\backslash \varphi^{-1}([-\varepsilon,\varepsilon]))\Big).$$
And thus it's $\mathcal C^\infty (M)$.