now writes generated code to a file.