Losing my place in the coding steps

Hi, so I just started out on HTML and I believe I was about half way done or more making the cat photo app and so I decided to take a break and then came back on and I wasn’t signed in, but I could still do the coding and then I realized this doesn’t make sense, so I signed in and I had to start from the beginning. Does anyone know what happened? Do I have to start from the beginning? How can I prevent this in the future?