Writes shell script