Thanks for your suggestions . I had another trial/error session but succeeded:
property tagDelimiter : "xxx"
tell application id "DNtp"
if (selected records) is {} then return
repeat with theRecord in (selected records)
set recordTags to tags of theRecord
repeat with theTag in recordTags
if theTag begins with tagDelimiter then
set md to true
add custom meta data (md as boolean) for "yyy" to theRecord
exit repeat
end if
end repeat
end repeat
end tell