So the question is, how to store those IDs and other intermediate results, so you can use them later?
Sorry, no hints for blogs or guides... your question is a general programming topic.
What to do? Basically you have "storage", which enable to store information, and retrieve that later.
For instance, you can write to a file, then save it. Later your program (or a different program) can open that file again and look for your information. This is easy to realize, you only have to make sure you have read and write access to the file.
When get a lot of things to store, say over 10,000, you should look into databases. At that point speed becomes an issue, you may want backups of the information, etc.etc. With databases you can have billions and billions of items. On the downside, it's a complicated topic - many libraries are filled with books on databases.
When you're in the cloud, you can't really have a local file to read from and write to. You may want to look at the solution seen in many AdWords scripts: information, settings etc. are stored in Google sheets.