Again, if you tell us what you are going for as an end result, happy to point you in the right direction, and it might save some frustration.
Do you want to put this output into the current draft? If so, the “Insert Text” step is probably what you are looking for.
If you are already scripting, it may be best just to do it all in the script.
Ultimately, however, if you are generating custom template tag values, you want to generate them all, and have them all set before you process any template that is expecting to use those values.
It seems like you are trying to do dates and date math and may not need scripting at all, either. Take a look at the article on using templates for details on working with and adjusting dates in template tags. For example you can just do [[date|+1 day|%Y-%m-%d]]
for tomorrow’s date.