Firstofall you dont need evel here because string attribs will be able to concatenete piror to running into command. you only ever need evel if you dont know how manty inputs you have, and iin thsi case you have a fixed amont! Reevaluate your knowlege of mel.
anyway theres a syntaxc terror
string $cmd = "expression -s \"" + "if(" + $posObj1[2] + ">" + 0 + ")" + "{" + $selObj[1] + ".translateZ" + "=" + $posObj2[2] + "-" + $distNode + ".distance;\"}" + "else {" + $selObj[1] + ".translateZ" + "=" + $posObj2[2] + "+" + $distNode+".distance;}\"");
anyway this is enough
CODE
expression -s ("if(" + $posObj1[2] + "> 0 ){\n "
+ $selObj[1] +".translateZ ="+ $posObj2[2] +"-"+ $distNode +".distance;\n}\n"
+ "else {\n "
+ $selObj[1] + ".translateZ" + "="+ $posObj2[2] +"+"+ $distNode+".distance;}");
NO eval needed jis jsut ecessive and slows your code down