You’re welcome!
You can have a unnecessary loop. Change your code to this…
tell application id "DNtp"
if (selected records) is {} then return
set tagMatchedFiles to (selected records whose (tags does not contain "xxx"))
repeat with theRecord in tagMatchedFiles
set md to false
add custom meta data (md as boolean) for "yyy" to theRecord
exit repeat
end repeat
end tell