when I am adding three names or more to the field [TeamWork]
That sounds like a multi value field. It is rare that you should do this, and will only cause issues unless you know how to handle them. How can your issue be fixed now? Fix your data structure or be prepared to face hurdles from now on. Suggest you research db normalization.
The code to remove the characters as explained in your original issue does not discriminate between the first, last or any line feed/carriage return in between. The fact that you didn't foresee that proves my point. Expect more barriers as you go if using your current approach.
The more we hear silence, the more we begin to think about our value in this universe.
Paraphrase of Professor Brian Cox.