Thank you for your post.
There are several factors for trying to set up a sync in FileMaker Pro. Fields that would become useful are Date fields set up for options with Modification Date. That is, anytime a record is modified, that Date (and Time if Timestamp field) is automatically entered into the field. This way, you can compare this information with the last time you synced, and if greater, than update the other file.
In your script, you would connect to the host database file and then perform the compares sinces the last sync. Once finished, you would update a field with the date and time of the sync completion.
Once a record needs to be updated, you would find the same record in the other file and make the updates. If the other record cannot be found, then you know it is a new record and needs to be updated. You'll also need to make a deletion file in case records are deleted, and you want them deleted in the other table. Otherwise, a record that was deleted would be added back again on the sync.
I would advise not doing this all at once. Perform each part one at a time until it works the way you want. Then, add the next part.
Let me know if you need additional clarification.