What version of FileMaker are you using. The syntax of your script needs updating to refer to the appropriate table occurrences in order for it to work with a recent version of FileMaker.
Your replace Field contents step (and others) should look like this:
Replace Field Contents [no dialog; YourTable::Mark ; ""] // and you need a field named marked defined in YourTable.
Set Field [YourTable::GlobalField ; YourTable::ClientID ]
If [YourTable::GlobalField ; = YourTable::ClientID ]
and so forth....
Also, with current versions of FileMaker, you can use a variable instead of the global field or you can use GetNthRecord to refer to the value in the previous record and not need a global field nor a variable.
I'm using filemaker pro 9
Then what I have posted is correct for your version.