The problem is due to not having a file with proper line termination
$ file prova.sh
prova.sh: POSIX shell script, ASCII text executable
$ cat prova.sh
#!/bin/sh
A="X Y"
A+=" Z"
echo "$A"
$ bash prova.sh
X Y Z
however
$ cp prova.sh prova2.sh
$ u2d prova2.sh
unix2dos: converting file prova2.sh to DOS format...
$ file prova2.sh
prova2.sh: POSIX shell script, ASCII text executable, with CRLF line terminators
$ bash prova2.sh
ZY
use d2u
to convert to the proper format. It is in the dos2unix
package
$ cygcheck -p usr/bin/d2u
...
dos2unix-7.4.2-1 - dos2unix: Line Break Conversion