$\textbf{Proposition: }$Let $(X,d_X)$ and $(Y,d_Y)$ be metric spaces. Let $(f_n)_{n\in\mathbb{N}}$ be a sequence of continuous functions from $X$ to $Y$ which is pointwise convergent to some $f:X\to Y$. If $X$ is not compact, but the convergence $f_n \to f$ is uniform on every compact subset of $X$, then $f$ is continuous.
$\textbf{Proof:}$ We know that if the convergence $f_n\to f$ is uniform on $K\subset X$, then $f$ is continuous on $K$.
Choose an $a\in X$. Let $x_n\to a$. We will show that $f(x_n) \to f(a)$.
Because $A=\{x_n\}_{n\in\mathbb{N}} \cup \{a\}$ is compact, $f$ will be continuous on $A$. Hence $f(x_n)\to f(a)$.
Is this proof correct?
Yes, I agree that the proof is correct.