This is an exercise from Diamond and Shurman's A First Course on Modular Forms. The goal is to show that if $f \colon \mathbb{H} \to \mathbb{C}$ satisfies $$f\left(\frac{a\tau + b}{c\tau + d}\right) = (c\tau + d)^kf(\tau)$$ for all $\tau \in \mathbb{H}$ and $\begin{pmatrix} a & b \\ c & d \end{pmatrix} \in \Gamma$ (here $k$ is an integer and $\Gamma$ is some congruence subgroup of $\textrm{SL}_2(\mathbb{Z})$ containing $\Gamma(N)$ for some $N$), and $f$ has an expansion at $\infty$ of the form $$f(\tau) = \sum_{n=0}^{\infty}a_nq_N^n, \quad q := e^{2\pi i\tau/N}.$$ with $\vert a_n \vert \leq Cn^r$ for some $C,r > 0$, then in fact $f$ is holomorphic at every cusp of $\Gamma$.
The exercise tells you to show that for $\begin{pmatrix} a & b \\ c & d \end{pmatrix} \in \textrm{SL}_2(\mathbb{Z})$, we have $$\lim_{q_N \to 0}((c\tau + d)^{-k}f\left(\frac{a\tau + b}{c\tau + d}\right)q_N = 0.$$
The suggested proof relies on an estimation shown in the first part, namely that for some $C_0,C_1 > 0$ we have $$\vert f(\tau) \vert \leq C_0 + C_1/y^r, \quad \textrm{Im}(\tau) = y,$$ for sufficiently large $y$. This follows from using the bound on the $a_n$ to estimate the tail end of the expansion at $\infty$ by $$\int_0^{\infty}t^re^{-2\pi ty/N} dt.$$ This depends on the fact that (assuming $r \geq 1$), the function $t \to t^re^{-2\pi ty/N}$ is decreasing on $[rN/(2\pi y),\infty)$. Of course, the number of terms one has to exclude depends on $y$. This is my main source of confusion. I don't see how we can apply the this estimate to $$f\left(\frac{a\tau + b}{c\tau + d}\right)$$ because $$\textrm{Im}\left(\frac{a\tau + b}{c\tau + d}\right) = \frac{\textrm{Im}(\tau)}{\vert c\tau + d \vert^2} \to 0 \textrm{ as } \textrm{Im}(\tau) \to \infty$$ but the estimate holds for sufficiently large $y$, not sufficiently small $y$>