It depends on what the Checkout Script is doing. The Checkout script needs to be told what portal row to go to for the checkout. It would probably be easiest to have a checkout button on the portal row so that when you click that butotn, your script already knows which portal record you want to update.
It is hard to know how to help without knowing what your scripts are currently doing.
My first suggestion would be to consider two portats, one filtered to show completed records only, the other filtered to show only those still requiring checkout entries. You can then use the GoToObject and GoToPortalRow steps to control which portal and row you need to act upon.