Coding Sun, Moon and Earth realistically

Hello, for a scool project I have to code the in the reality existing system containing sun, moon and earth as realistically as possible. In my opinion the three bodies should move witch my current code as they do in reality. I put the real values into the equation of motion. What did I do wrong? I would really appreciate any tips or help. Thank you!
Here is the link of my current code: p5.js Web Editor


Your moon and earth flying away, so it looks like your attractive gravitational force is not strong enough.
I would adjust it to a point that the earth gets the right trajectory.

Right now you probably only need to increase the starting velocity of the earth to put it on orbit, also you’d need to change the position and starting velocity of the moon as well, because it looks like the starting position is inside the earth. I wouldn’t know where to apply the changes in your code, but i’m working on a similar demo, and thats all i needed to make mine follow an orbit. At the end of the day you’d probably need a lot of fine tuning if you want a consistent orbit tho. Gool luck, I hope I helped.