Go To Object [ portalobjectname ]
Go To Portal Row [ first ]
If [ portaltable::portalfield = "match condition" ]
Set Variable [ $copy ; whatever you want to copy ]
Exit Loop If [ true ]
Go To Portal Row [ Next ; exit after last ]
If [ isempty ( $copy ) ]
Show Custom Dialog [ "no match was found" ]
Set Field [ parenttable::destination ; $copy ]
That should do it. Augment as needed for additional fields.
I would as a general rule avoid looping through portal rows in the first place as this produces a script that easily "breaks" when sometimes even minor layout changes are made at some point in the future.
There are other and (in my opinion) better options.
ExecuteSQL might be used to return the portal record's primary key. You set a field in your parent record to that value and your fields, if set up with auto enter field options (calculations or looked up values) to copy over the needed data.
You might use a new and "off screen" window to pull up a found set of portal records and loop through them. (but this can still trip at least two script triggers on your current layout.)
You might use List to get a list of Primary keys from your portal and use a global field to point to one record at a time in a loop to check each value in turn. In all three of these, all you really need to get is that Primary Key.
All of the above methods enable you to search out a value while being much less sensitive to layout changes that might cause your script to fail at some point in the future.