Uniform convergence on compact sets and limits at infinity Suppose that we have a sequence of continuous functions $(f_n)_{n \in \mathbb{N}}$,
$f_n: \mathbb{R} \rightarrow \mathbb{R}$,
which converges uniformly on compact sets to a function $f$, and that we have moreover that all that limits $a_n:=\lim_{x \rightarrow \infty} f_n(x)$, as well as $a:= \lim_{x \rightarrow \infty} f$ exist. Can we necessarily conclude that $\lim_{n \rightarrow \infty} a_n=a$?

No. Consider a sequence of function $f_n$ defined as follows: $f_n$ is $1$ on the interval $[-n,n]$, it is zero outside $[-n-1,n+1]$ and continuous on $[-n-1,-n]\cup [n,n+1]$.
For example $$f_n(x)=\left\{\begin{array}{ll} 1 & \text{ for } |x| < n\\
0 & \text{ for } |x|>n+1\\ 
-x+n+1 &\text{ for } n\leq x\leq n+1\\
x+n+1 &\text{ for } -n-1<x<-n  \end{array}\right.$$
The functions $f_n$ converge to the constant function $1$ on compact sets. Buth with your terminology we have $a_n=0$ forall $n$ and $a=1$.
