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
w=DWELLING$'\r' # $'\r' creates a carriage return in bash
echo $w | tr -d '\r' # tr can delete carriage returns