Implode output array if command fails. Also use PHP_EOL instead of \n