If two integrals are equal, then the functions are the same

Fundamental theorem of calculus: Let $a<b$ and let $f$ be a continuous (real valued) function on $\lbrack a,b\rbrack\subset \mathbb{R}$. Then, $\forall x\in (a,b)$, we have $$ f(x)=\dfrac{\mathrm{d}}{\mathrm{d}x}\int_a^x f(t)\;\mathrm{d}t.$$

As an application of this theorem for your problem, since $f$ and $g$ are continuous on $\mathbb{R}$, you can fix $a\in\mathbb{R}$ and choose any $a<x$. You then have $$\int_a^x f(t)\;\mathrm{d}t=\int_a^x g(t)\;\mathrm{d}t$$ by hypothesis (and this is for any $x\in\mathbb{R}$). Differentiating both sides gives $f(x)=g(x)$ for any $x\in\mathbb{R}$. Thus, $f=g$, as requested.