where you have
msg $chan A thank you has been added to $2 's record.
you should make it
msg $chan A thank you has been added to $2 $+ 's record.
That will bring $2 and 's together to form 's