Changes to file.py prepend and append.

Fixing the append and prepend functions to show a diff when there are changes for #11827.