Seems like you are struggling with step 4 "Use your script to replace all [LABEL] occurrences in the GraphML file with consecutive numbers." Well, this is actually the one step that is totally unrelated to yEd. For programming related task (and scripting is programming), a programming forum dedicated to the scripting language you use is a much better place to ask for help. Additionally, I suggest to start small. If your file is over 1MB in size, it contains a lot of text and is most likely not well-suited for testing your script. Use a simple, short text file with only a few words aside from "[LABEL]" for testing your script. Make sure it works for the simple case (including not changing the file extension). After getting your script to work successfully for the simple text file, create a one node diagram, save that diagram in GraphML format (which should result in about 40 lines of text), and test your script with the aforementioned GraphML file. Only after ensuring that your script works as intended with said small GraphML file, run your script on your big file.
And yes, the forum prevents file uploads for files larger than 1 MB.