How to actually concatenate two Strings?
Your lambda is capturing arg by copy, which is most certainly not what
you want. And since it doesn't have the mutable qualifier, the
captured parameters are not modifiable. Hence the compiler error.

You could get rid of the error by qualifying the capture as mutable,
but you would then be modifying the captured copy of arg, not the
original one. The correct solution would be to capture the String by
reference instead of capturing by copy. See Lambda
expressions.

But then, I concur with Michel Keijzers that avoiding Strings altogether
is a better option.