If know $\Bbb R=\bigcup\limits_{n}[n,n+1)$ along with the splitting $ [n , n+1) = [n,n+\frac{1}{2^n})\cup[ n+\frac{1}{2^n},n+1)$
Then, $$\Bbb R=\bigcup\limits_{n\ge 0} \left([n,n+\frac{1}{2^n})\cup[ n+\frac{1}{2^n},n+1)\right)$$
We set the functionn $f$ (see its construction below)
\begin{equation}
f(x)= \begin{cases}
\underbrace{-2^{2n+2}(x-n)^2+2^{n+2}(x-n)}_{P_n}& \text{if} ~~ n\le x\le n+\frac{1}{2^n} ~~\text{for some $n\in\mathbb{N}$}\\
0 &\text{ if}~~~j+\frac{1}{2^j}\le x\le j+1~~\text{for some $j\in\mathbb{N}$}\\ f(-x)& \text{if }~~x\lt 0.
\end{cases}
\end{equation}
($h =1$, $ \varepsilon_n =\frac{1}{2^n}$, $a_n = n$ and $b_n =n+\frac{1}{2^n}$)
One can check that $f$ is an even and continuous function. Further, we have
$$ \int_\mathbb{R} f(x)\,dx= 2\sum_{n=0}^{\infty}\int_{n}^{n+\frac{1}{2^n}} P_n(x) dx = 2\sum_{n=0}^{\infty}-4
\left[ \frac{2^{2n}}{3}(x-n)^3-\frac{2^n}{2}(x-n)^2\right]_{n}^{n+\frac{1}{2^n}}\\
= \frac43\sum_{n=0}^{\infty} \frac{1}{2^n}= \frac{8}{3} $$
Morerover, for every $n\in\mathbb{N}$ one has $$f(n) = 0~~and ~~~f(n+\frac{1}{2^{n+1}}) = 1 $$
Therefore $$\lim_{|x| \to \infty}|f(x)|\not \to 0 $$
further, $\lim_{|x| \to \infty}|f(x)|$ does not exist.
Construction of f:
The aim is to construct a family of polynomial $P_n: [a_n,b_n]\to \mathbb{R}$ of degree equals to 2 with $ P_n(a_n)=P_n(b_n)=0 ,P_n(\frac{a_n+b_n}{2}) = h$ such that
$$ \int_{a_n}^{b_n} P_n(x) dx =\alpha_n ~~~\text{with } ~~\sum_{n=0}^{\infty} \alpha_n <\infty$$
where $b_n =a_n +\varepsilon_n $, $\varepsilon_n\to 0$, the sequence $(a_n)$ is increasing and the family $([a_n,b_n])_n$ is pairwise disjoint.
First step
$P_n(x) = c(x-a_n)(x-b_n) = c(x-a_n)^2-c\varepsilon_n(x-a_n) ~~$ $c\in \mathbb{R}$
and
$P_n(\frac{a_n+b_n}{2}) = h$ entails $-c\left(\frac{a_n-b_n}{2}\right)^2= h$
that is $c= -\frac{4h}{\varepsilon^2_n}.$
Second Step
\begin{split}
\int_{a_n}^{b_n} P_n(x) dx &=&-\frac{4h}{\varepsilon^2_n}
\left[ \frac{1}{3}(x-a_n)^3-\frac{\varepsilon_n}{2}(x-a_n)^2\right]_{a_n}^{b_n =a_n+\varepsilon_n}\\
&=& \frac{2h\varepsilon_n}{3} = \alpha_n
\end{split}
Therefore
$$ \sum_{n=0}^{\infty} \alpha_n <\infty\Longleftrightarrow\sum_{n=0}^{\infty} \varepsilon_n <\infty.$$
Whence we chose
$a_n= n,2^n,.... $ and $\varepsilon_n = \frac{1}{n^s}, \frac{1}{n!},\frac{1}{2^n},\frac{1}{3^n}...$
for simplicity $a_n= n$ and $\varepsilon_n = \frac{1}{2^n}$
so that
$$P_n(x) = -\frac{4h}{\varepsilon^2_n}(x-n)^2+\frac{4h}{\varepsilon_n}(x-n)$$
Last step
One can easily check that the family of intervals $([n,n+\frac{1}{2^n}])_n$ is pairwise disjoint
We then define the function
\begin{equation}
f(x)= \begin{cases}
\underbrace{-\frac{4h}{\varepsilon^2_n}(x-n)^2+\frac{4h}{\varepsilon_n}(x-n)}_{P_n}& \text{if} ~~ n\le x\le n+\frac{1}{2^n} ~~\text{for some $n\in\mathbb{N}$}\\
0 &\text{ if}~~~j+\frac{1}{2^j}\le x\le j+1~~\text{for some $j\in\mathbb{N}$}\\ f(-x)& \text{if }~~x\lt 0.
\end{cases}
\end{equation}
We can check that $f$ even, continuous and we have
$$ \int_\mathbb{R} f(x)\,dx= 2\sum_{n=0}^{\infty}\int_{a_n}^{b_n} P_n(x) dx = 2\sum_{n=0}^{\infty} \frac{2h}{2^n3} = \frac{8h}{3} $$
Morerover, for every $n\in\mathbb{N}$ one has $f(n) = 0$ and $f(n+\frac{1}{2^{n+1}}) = h $
thus $$\lim_{|x| \to \infty}|f(x)|\not \to 0 $$
further, $\lim_{|x| \to \infty}|f(x)|$ does not exist.