Added create_file

Isolated file creation into a function.