If the text was edited in Windows there could be a carriage return character at the end of each line.
\n is the end of line code for Linux
\r\n is the end of line code for Windows
\n represents a newline character
\r represents a carriage return character
Code:
w=DWELLING$'\r' # $'\r' creates a carriage return in bash
echo $w
w='a'$w'b'
echo $w
echo $w | tr -d '\r' # tr can delete carriage returns
DWELLING
bDWELLING
aDWELLINGb