How to comment in existing host file

See if any of the methods shared in Universal append to hosts file could be of help for you.