To append actual code to a file, we use .write(). This adds code without deleting what was previously there. 

Give .write() a try by writing a Python comment in the code.py file.

Now the file code.py contains the comment you appended:

That's great work! 

Make sure to call .write("// Appending virus code") by placing the code after python_file.