Bug with Search and Replace when checking list with duplicate items? [SOLVED]

Could you please still explain anyway why the extra quotes appear in the output from @alltiagocom's macro? I can smell that there is logic to it all but I haven't worked it out yet...

I note with interest that if the second "Tiago" is renamed "Tiago2", the output is:

"tiago",
"paulo",
"miguel",
"tiago",2