Let me guess.
You run lazarus as root. Run the program from within Lazarus, create the file.
Now the file is owned by root.
Then you run the program as normal user (by double-clicking on the name, as you said) , you try to rewrite the file that already exists, but that file is owned by root and cannot be written to by a normal user.
Change the ownership of the file to yourself (being normal user), something like
sudo chown <your username> <the filename in question>
Bart