Welcome to the community!
In order for the missile to figure out where it is, it first needs to know where it isn’t.
If you give the model a sequence of similar tasks that it needs to do, it needs to be able to figure out that what it just did isn’t the last thing it was supposed to do.
After generating a section, you need to give it an opportunity to figure out what it just did, and what to do next. My goto solution for this is to ask it to wrap every section in an XML tag, so that it’s forced to figure out what the next xml tag is.
E.g.; there’s no ambiguity whether it finished section 1 or section 5, if the model is forced to close the section 1 tag. and after closing the section 1 tag, the only logical option is to open the section 2 tag - and after opening the section 2 tag, the only logical option is to write section2.
Here’s an example of using this approach to generate multiple dalle images in a single prompt: Inline images in GPTs between text - #4 by Diet
Note that the models are trained to weasel themselves out of long generations, so be aware that there’s a limit to this technique with chatgpt.
If you use the API and intend to publish them on the open internet, you need to put it behind a gateway to manage access. The API is a raw tool that needs to be combined with other things to make it useable and secure.