Two changes should help:
use the special dollar-single-quote form:
nl=$'\n'
and
use quoting:
echo "$all"
Also, you can suppress character output during read for passwords without using stty by doing using -s (and you should almost always use -r):
read -s -r -p "Password: " pass
Change your shebang to specify Bash:
#!/bin/bash
because on many systems /bin/sh is not a symlink to Bash.