How to automate ssl certificate generation with certbot

I can read and understand the script, I just don't understand the why if the script. It looks like it does functions which certbot itself can do perfectly?

In any case, it looks like your authenticator script is malfunctioning.