Sequel to the question I asked Prove that if f is continuous on $[a,\infty)$ and if $\lim\limits{x\to \infty}f(x)$ exists then $f$ is uniformly continuous and the reply I got, I want to show that $f$ is uniformly continuous on $\Bbb{R}$ if it is continuous on $\Bbb{R}$ and $\lim\limits_{x\to +\infty}f(x)$ and $\lim\limits_{x\to -\infty}f(x)$ exist
Let $\epsilon>0$ be given.
$\lim\limits_{x\to -\infty}f(x):=k$ exists at $N_\epsilon \in \Bbb{R} \implies\;\exists\,N_\epsilon<a,$ s.t. $\forall \;x< N_\epsilon,\;\;|f(x)-k|<\epsilon/2.$ The set $[N_\epsilon,a]\subset(-\infty,a] $ is a compact set and so, $f$ is uniformly continuous on $[N_\epsilon,a]$, i.e. $\exists\;\delta_1=\delta_1(\epsilon)>0\;$ s.t. $\forall\;x,y\in [N_\epsilon,a]$ with $|x-y|<\delta_1$, we have $|f(x)-f(y)|<\epsilon$.
$\lim\limits_{x\to \infty}f(x):=l$ exists at $M_\epsilon \in \Bbb{R} \implies\;\exists\,M_\epsilon>a,$ s.t. $\forall \;x> M_\epsilon,\;\;|f(x)-l|<\epsilon/2.$ The set $[a,M_\epsilon]\subset[a,\infty)$ is a compact set and so, $f$ is uniformly continuous on $[a,M_\epsilon]$, i.e. $\exists\;\delta_2=\delta_2(\epsilon)>0\;$ s.t. $\forall\;x,y\in [a,M_\epsilon]$ with $|x-y|<\delta_2$, we have $|f(x)-f(y)|<\epsilon$.
Since $f$ is continuous at $N_\epsilon \in \Bbb{R} \implies\;\exists\,\delta_3=\delta_3(N_\epsilon,\epsilon)>0$ s.t. $\forall \;x\in [N_\epsilon,a]$ with $|x-N_\epsilon|<\delta_3$ we have $|f(x)-f(N_\epsilon)|<\epsilon/2.$
Also $f$, continuous at $M_\epsilon \in \Bbb{R} \implies\;\exists\,\delta_4=\delta_4(M_\epsilon,\epsilon)>0$ s.t. $\forall \;x\in [a,M_\epsilon]$ with $|x-M_\epsilon|<\delta_4$ we have $|f(x)-f(M_\epsilon)|<\epsilon/2.$
Take $\delta=\min\{\delta_1,\delta_2,\delta_3,\delta_4\}$ s.t. $\forall\;x,y\in (-\infty,\infty)$ with $|x-y|<\delta$. WLOG, we take $x<y$.
Case 1: $x<N_\epsilon<a<y$
$|f(x)-f(y)|=|f(x)-k+k-f(y)|\leq |f(x)-k|+|f(y)-k|<\epsilon/2+\epsilon/2=\epsilon$
Case 2: $a<M_\epsilon<x<y$
$|f(x)-f(y)|=|f(x)-l+l-f(y)|\leq |f(x)-l|+|f(y)-l|<\epsilon/2+\epsilon/2=\epsilon$
Case 3: $N_\epsilon<x<y<a$
$|x-y|<\delta$, we have $|f(x)-f(y)|<\epsilon$
Case 4: $a<x<y<M_\epsilon$
$|x-y|<\delta$, we have $|f(x)-f(y)|<\epsilon$
Case 5: $N_\epsilon<x<a<y$
$|f(x)-f(y)|=|f(x)-f(N_\epsilon)+f(N_\epsilon)-f(y)|\leq |f(x)-f(N_\epsilon)|+|f(y)-f(N_\epsilon)|<\epsilon/2+\epsilon/2=\epsilon$, since $|x-N_\epsilon|<|x-y|<\delta$ as well as $|y-N_\epsilon|<|x-y|<\delta$
Case 6: $N_\epsilon<x<a<y$
$|f(x)-f(y)|=|f(x)-f(M_\epsilon)+f(M_\epsilon)-f(y)|\leq |f(x)-f(M_\epsilon)|+|f(y)-f(M_\epsilon)|<\epsilon/2+\epsilon/2=\epsilon,$ since $|x-M_\epsilon|<|x-y|<\delta$ as well as $|y-M_\epsilon|<|x-y|<\delta$
Hence, $f$ is uniformly continuous on $\Bbb{R}$.
Please, I'm I right? If no, can anyone please provide a detailed proof?