You may need to quote the echo to keep the format:
echo -e "$(sort $1 | uniq -d)"
See an example:
$ myvar="hello
> how
> are
> you"
$ echo $myvar <--- unquoted, loses the format
hello how are you
$ echo "$myvar" <--- quoted, keeps the format
hello
how
are
you