Execute code on remote machine and copy the results back

I would attempt to put the arguments to ssh in double quotes.

ssh usr@machene_wehere_i_run_the_code "/home/run_dir_script/run.sh inp 8"

Also based on that error message it sounds like the script cannot find this script:

/home/run_dir_script/run.sh: line 59: /home/run_dir_script/merge_tabs.sh: No such file or directory

Also I'd block the scp from happening if the ssh doesn't return a successful status:

ssh usr@machene_wehere_i_run_the_code "/home/run_dir_script/run.sh inp 8"
status=$?

if $status; then
  scp -p usr@machene_wehere_i_run_the_code:/home/run_dir_script/results \
    user@machine_where_the_resutlst_are_needed:~/
fi

Bottom line problem though is that there's an issue with your script locating the subordinate scripts on the remote system. There may be variables that are set when you login and run your script, vs. when you login via ssh and run your script.

For these I would compare the output of env using both methods.