I am unable to replicate this on my v7.7.1 test site under PHP 7.2.10. Additionally, I was unable to replicate this at UBBDev on v7.7.2 and PHP 5.4.45.
Steps:
1 Open the custom code page in the control panel and save
2 open the file via FTP (cache_builders/custom/) and see the code properly displayed
3 save the custom code via the CP again
4 open the file again and it still appears as expected
What version of UBB.threads are you running? Is your custom island coding following the example formatting, including the body eof lines? Do you have any modifications installed? What version of UBB.threads are you running? What is the content of the Custom Island that keeps being updated with additional coding?