Here is a proof for arbitrary Lebesgue measurable $f$. As the other answer shows, $A=F\cup N$ for some Borel set $F$ and a null set $N$. Let $U\in \tau_{\mathbb R}.$ Then the fact that $f$ is Lebesgue measurable implies that $f^{-1}(U)=V$ is Lebesgue measurable and so has the form $F\cup N$, as above.
Let $\{I_n\}_{n\in \mathbb N}$ be an enumeration of the collection of intervals with rational endpoints, which form a base for $\tau_{\mathbb R}.$
Then, there are Borel sets $\{F_n\}_{n\in \mathbb N}$ and null sets $\{N_n\}_{n\in \mathbb N}$ such that $f^{-1}(I_n)= F_n\cup N_n.$ Furthermore, $U=\bigcup^\infty_{k=1}I_{n_k}$ for some subsequence. Then, $f^{-1}(I_{n_k})=F_{n_k}\cup N_{n_k}.$
Define $g:\mathbb R^n\to \mathbb R$ by $g(x)=f(x)$ if $x\in F_n$ for some $n$ and $g(x)=0$ otherwise. Then, $g$ agrees with $f$ except perhaps on $\bigcup_n N_n$, which is null. And $g^{-1}(U)=g^{-1}(\bigcup^\infty_{k=1}I_{n_k})=\bigcup^\infty_{k=1}F_{n_k}\cup g^{-1}(\{0\}),$ which is a Borel set. It follows that $g$ is Borel measurable.
Remark: if you know that $\mathscr B(\mathbb R)$ is generated by the intervals $\{(-\infty, r):r\in \mathbb Q\}$, then you can show that it suffices to prove the claim for these intervals only. Then the proof is much easier: For each $r\in \mathbb Q,$ choose a Borel set $B_r\subseteq f^{-1}((-\infty,r))$ such that $f^{-1}((-\infty,r))=B_r\cup N_r$ for some null set $N_r$. Now define $g(x)=f(x)$ if $x\in B_r$ for some $r$ and $0$ otherwise. Then, $g^{-1}((-\infty,r))=B_r\cup g^{-1}(\{0\}).$