if (x+y > sizeof(myMsg)-1){break;}
sizeof() is the wrong method. strlen() is the correct method.
char msg[200] = "Joe";
sizeof(msg) --> 200
strlen(msg) -->3
In the function, the array is passed as a pointer, despite the way that you have it defined. The sizeof() a pointer is the same as the sizeof() an int - 2 bytes. The strlen() function will return the same value in loop() and in the function.