There's no real scripting required, but definitely some some database design work needed to do what you want here.
then create a list of the unique contacts
Does that mean that you have records in either file's table that are not unique within that one table? I will assume that you do not have records with duplicate IDs in the same table, but if so, let me know as there's an easy way to filter out the duplicates.
Take either database file and open Manage | Database | Relationships.
Use the far left bottom button to create a new table occurrence box on your relationship graph.
Use the Add Filemaker Data Source option in the drop town list in the dialog that appears to select first the other file and then the other contacts table. You now should have an occurrence of both contacts tables in the same relationship graph.
Link the newly added table occurrence to an existing table occurrence of the other contacts table by their ID fields.
Let's refer to the two table occurrences as Contacts A and Contacts B. (You can double click a table occurrence box to open a dialog where you can rename a table occurrence.)
If you go to or create a layout based on Contacts A, you can place the ID field from Contacts B on this layout. If you then enter find mode, specify an * in this field and select the omit option from the status tool bar area, you can perform a find and get a found set of all records in Contacts A that are not also found in Contacts B.
You can go to or create a layout based on Contacts B and use the same method to get a list of all Contacts B records that do not match the ID of a record in Contacts A.
No scripting required to do any of that, but you can script the find if you wish.