Your procedure works, just be aware of the systematic error (the smaller the steps, the more accurate the result, of course). This is a version of numerical modelling, a well-recognized prediction method.
But a mistake shows in your method from the comments.
The formula $$g=G\frac{M}{r^2}$$ only holds true outside Earth. The Earth mass is constant, but it's gravitational pull "spreads out" over a quadratically larger area (a spherical surface area is $4\pi r^2$, so e.g. doubling distance quadruples the area, which the same mass must pull in). In more correct terms, the gravitional field, which is what $g$ represents, is "spread more out" and becomes quadratically weaker with distance.
Inside Earth on the other hand some mass cancels out. It is not the same mass pulling in you all the time, which the above formula assumed. In the centre, gravity is zero, since there is the same amount of mass in all directions pulling equally. If you are on the way down towards the centre, it turns out that all mass "above" you (the spherical shell above you) cancels out on itself and leaves all mass "below" you (the sphere below you) as if it was alone - as if it was a smaller planet attracting you.
The same formula can therefore be used inside Earth, if the entire Earth mass is replaced by the mass "below":
$$g=G\frac{M_{below}}{r^2}=G\frac{V_{below}\varrho}{r^2}=G\frac{\frac43\pi r^3\varrho}{r^2}=G\frac43 \varrho \pi r$$
Here mass is split into density and volume $M=V\varrho$ and sphere-volume is $V=\frac43 \pi r^3$. This does though assume constant density throughout the depth of Earth, which isn't entirely the case. A more realistic gravity variation is shown in the graph in an answer to this question. But for your project, the assumption might be enough. (The average density can be looked up on Google.)