A file created through code or in any other way in your repl is saved not on your local machine, but in your cloud repl. Any changes to your repl will not affect your local machine in any way. To download files from your repl to your local machine, you can click on the ⋮ button near the file name and select Download (only one file will be downloaded), or click on the ⋮ button at the top of the file panel and select Download as zip (downloads all files of your repl).
When a program is run, the directory which the file executed is located in becomes the current working directory, so by default, any files created will be within this directory. You can of course change the current working directory using os.chdir or you can specify a subfolder /some subfolder/file.smthn.