finished the script: added a command file generator and file write