How can i add this in a custom document

Have a look at offer_letter.js

thank you but as you can see upthere when i put the custom scrip and modifie to my case it does not open the doc.

It seems you have an issue in your JS code, open your browser’s console to check. In Chrome do CTRL + Shift + I and see the Console tab

thank you going to see

when i copy the code i have this error and not understanding