I'm not really sure what you're asking in the op but you can use Writer and Reader to write and read to files respectively.
Then you can use this information to select where to start the script from. For example write the number 5 to a file, then when you run the script again read that file and you know to start from point 5.