the file is not generated
The file is generated, it just writes to the directory returned by pwd(). This is likely not where you expected it to be?
You can always give the full path, for example, on my machine it would be write_to_file(model, "/Users/Oscar/Desktop/modelplus.lp").