It's your 'Clear Payment Globals' subscript that runs near the top of the script. This subscript breaks the context with portal, so when the script later gets to the GTRR step, it doesn't know which portal row to act on, so it goes to the first record every time.
At the top of your script, capture the name of the portal (which you set in the Object Info window, accessible from the View menu) using Get ( ActiveLayoutObjectName ), and the number of the portal row you want the script to act on using Get ( PortalRowNumber ).
After the subscript has run, and just before the GTRR script step, go back to the portal object (using Go To Object) and the correct portal row (using Go To Portal Row).
Obviously, you're going to need to put a button (or make one of the fields or the entire row 'clickable') on the portal so that the script can run for a specific portal row.
I hope this helps!