Hello together!

I have a STATA program that I got from a research paper and I modified it a little bit. I run the program and it returned the outcome I need. However, when I copied it to another folder and run it again, it just produced a totally different outcome. Do you have any suggestions to fix it ?

To make it clear: I copied both the program file and the data file to the new folder, so basically I have EXACTLY the same programs and datasets in the 2 folder. I also changed the directory in the new copied file to the new folder already. I am using STATA 15.

Here you can find the program and dataset, along with an image of the output I want.

I'm totally new to STATA so my question my be vague ... I hope I can make it as clear as possible if you have any questions.

Thanks in advance!