I think this piece of advice might be more helpful:

Sometimes you have to build a script piece by piece to make sure it works correctly, rather than throwing everything together at once and wondering for days why it doesn’t work. Do diagnostics for every step.