To target a portal and walk it's records:
In Layout mode give the target portal an object name with the inspector.
Your script should contain the following steps / logic.
In your script use the go to object command giving the object name, then Go to Portal Row [First].
use Set Variable to collect your data, go to a layout based on your destination portal table, create new record and set Field from your variables.
go to layout( original )
Go to Portal Row [Next].Exit after last
This is pseudo code to give you the idea, however, in filemaker there are many ways to accomplish the task.