I know the statment is false but I cant find a good counter exemple, this is what I've tried:
$$f(x) = \begin{cases} x, & \text{if $x \in \mathbb Q$} \\ -x, & \text{if $x \notin \mathbb Q$} \end{cases} $$ so $\lim_{x\to \infty} |f(x)|= \infty$ , and I want to express my function using Dirichlet function (which I already know that its limit does not exist), but I can't figure out how. Any help is greatly appreciated.
Let $D:\mathbb R \to \mathbb R$ the Dirichlet function. Then you have $$ f(x) = x \cdot (2 \cdot D(x) - 1) \qquad \text{for all } x \in \mathbb R.$$ Intuitively you scale it with factor $2$, shift it $1$ unit down to get a function which is $1$ on $\mathbb Q$ and $-1$ on $\mathbb R \setminus \mathbb Q$ so you can multiply it by $x$ to get the wanted function :)