note the helpful indenting in the prompt
zsh% A=$(
cmdsubst> cat <<EOF
cmdsubst heredoc> boep boewp
cmdsubst heredoc> dootles
cmdsubst heredoc> EOF
cmdsubst> ) ; echo $A
boep boewp
dootles
zsh%
where my newlines gone to?
bash-3.2$ A=$(
> cat <<EOF
> foo bar
> blaz zang
> EOF
> ) ; echo $A
foo bar blaz zang
bash-3.2$