How to create files:
Step 1. Read the PHP manual.
Step 2. Hey, if you paid attention to the manual, you're done already!
There are plenty of examples for writing files in the manual.
If your script will be the only one accessing the files, then security is not one of your biggest problems.