Edit: I just discovered Replace function… Things below are irrelevant but I’m leaving it for educational purpose for those who hasn’t discovered it yet
Without knowing much about the Rhino Tab components, this seems to make sense to me.
You are reading the keys and creating new text based on the strings read. Then assigning the content new keys, which will overwrite existing ones of the same name, and append new ones that do not yet exist. In short, Replace Text isn’t working on the keys themselves, but the strings of the keys.