Understanding of solution for the functional equation $(x-y)f(x+y) - (x+y)f(x-y) = 4xy\left(x^2 -y^2\right)$ Problem

For all $x,y \in \mathbb{R}$ which is $x^2 \not = y^2$, a function $f$ satisfies the following.
$$(x-y)f(x+y) - (x+y)f(x-y) = 4xy\left(x^2 -y^2\right)$$
Find the function $f$.

Solution
Divide both side of the given formula by $x^2-y^2$:
$$\frac{f(x+y)}{x+y} - \frac{f(x-y)}{x-y} = 4xy$$
Let $g(x)=\frac{f(x)}{x}$, then
$$g(x+y)-g(x-y) = 4xy$$
$$g(x+y) - (x+y)^2 = g(x-y) - (x-y)^2 \tag{*} \label{a} $$
Now there exists adequate constant $k$ such that
$$g(x)-x^2 = k$$
Question
I know that $g(x)-x^2$ is constant function by \eqref{a}, just intuitively, but I can't prove it. How can we prove it?
Also, I want to know whether we have to add the condition that co-domain of $f$ is $\mathbb{R}$ or not.
 A: Actually, you cannot conclude that $g$ is constant, at least not if you want to extend that statement also to $g(0)$: In order for $(*)$ to make a statement about $g(0)$ you need to apply the original functional equation to $y=\pm x$, i.e., $x^2=y^2$. Neither is it given that the original functional equation holds in that case, nor could we still rely on it as we obtained $(*)$  after dividing by $x^2-y^2$, nor is $g(x)=\frac{f(x)}{x}$ even defined for $x=0$. 
So some care is necessary. Maybe there are more traps hidden? Let's see.
Let $k=g(1)$. Let $t\ne0$ be arbitrary. We want to show $g(t)=k$. To do so find $x,y$ with $x+y=t$ and $x-y=1$, i.e., let $x=\frac{t-1}{2}$, $y=\frac{t-1}{2}$; then $(*)$ shows $g(t)=g(1)=k$ as desired.
Unwinding everything, you find that $$f(x)=x\cdot (k+x^2)=kx+x^3\qquad \text{for $x\ne 0$}.$$
Note (once more) that nohing can be infered about $f(0)$. After all, no instance of the original function equation is applicable to $f(0)$ sinc $y=\pm x$ is "forbidden". 
Thus $f$ is a solution if and only if there are constants $k$ and $y_0$ such that
$$ f(x)=\begin{cases}kx+x^3&\text{if $x\ne 0$}\\y_0&\text{if $x=0$}\end{cases}$$

It may not be necessary to state that the codomain is $\mathbb R$, but strictly speaking something about the codomain should be required in the problem statement.
For the functional equation to make sense, we certainly need that multiplying elements of the codomain with real numbers as it happens on the left hand side makes sense; this suggests that the codomain should at least be a $\mathbb R$ vector space. Also, the difference taken in the left hand side should produce a real number (right hand side); so the vector space should have $\mathbb R$ itself as subspace. The simplest structure matching this would be a field extension of $\mathbb R$ (such as $\mathbb R$ itself, but possibyl also $\mathbb C$, or some other). As it turns out this won't change the result, except that it changes where we pick our arbitrary constants $k$ and $y_0$ from. (And that's also why I didn't write "if there are costants $k\in\mathbb R$ and $y_0\in\mathbb R$ such that").  If the codomain is $\mathbb C$, we can pick $k,y_0\in\mathbb C$, for instance.
So while the derivation doesn't really change and the result doesn't change in its essence, you are right: For a rigorous problem statement, the codomain should have been specified.
