Press O to save position, press up arrow to move the black thing around, and down arrow to "load" your most recent save. Press space to get save coordinates.
Actually, this didn't take very long. The program uses variables to save positions and teleport them to the last save coordinates. However, this can be used for a lot of things. You can base the code of this, or remix it, but GIVE ME CREDIT for this save engine if you use it.