When doing big changes with uncertainty, its best to do it on a staging site first. Also, it’d be really helpful if you have FTP access as you can just open functions.php through that when the site crashes.
Btw, do you have any particular reason why it must be added to the functions.php file?
If I may suggest, instead of adding things on functions.php, I believe you can simply add your code on a Hook element and just hook it to wherever you want to place the ads.
A wise man once said:
"Have you cleared your cache?"