Well, first you have to tell, what $E_g$ is and how do you measure it. You are probably using formula for change of potential energy:
$$
E_g=mg h
$$
Where $m$ is mass, $g$ is gravity acceleration and $h$ is height. This particular formula is not completely right, to be completely formal we should rewrite it as:
$$
\Delta E_g=mg\Delta h
$$
$\Delta$ represents the difference, eg. $\Delta E_g=E_{g_{END}}-E_{g_{BEGINING}}$ (final state - initial state). So your equation is technically correct:
$$
E_{g_{BEGINING}}=E_k+E_e+E_{g_{END}}.
$$
Now we should talk, how we define $E_g$. In classical mechanic you will normaly define it in Kepler potential as $E_g=-G\frac{mM}{R}$, which is useful for calculating celestial mechanics, but not simple kinematics...
For your case you can use formula $\Delta E_g=mg\Delta h$, which gives only energy difference as mentioned. But you don't know nothing about initial or final $E_g$. So you generaly say that one of this two energiyes iz 0, since you are always calulating with energy differences. You generally say, that 0 is the lowest position possible, to avoid calculating with negative $E$. So if we take in count $E_{g_{END}}=0$, your formula yields:
$$
E_{g_{BEGINING}}=E_k+E_e
$$
NOTE: $g$ is function of distance from center of Earth $R$. This is already taken in count in formula for gravitational potential energy in Kepler potential. But for exeriments near Earth surface, g is changing so slowly, that we assume, thaat it is constant, and therfore calcuate only with energy differences.