The = operator must always be written without spaces around it:
result="$result $d"
(Pretty much the most important difference in shell programming to normal programming is that whitespace matters in places where you wouldn't expect it. This is one of them.)