It would be better to use some Filter array action conditional to check if an array of the primary keys from the master file contains each primary key of your new file.
That single action would then return every item in the new file that needs to be updated with an item from the new file.
You would use the same set-up, but set the Filter array conditional to Does not contain to get the new records to create.
That would avoid any loops for the checks and be much more efficient.
And to get an array of just the primary keys from the master file, you can use the Select action on the master file outputs.
You can then use the setting on the right side of the Select to change the table to an empty box input where you can insert an expression
item()[‘InsertPrimaryKeyColumnName’]