Razza, the delineator makes a difference with sed. The code below or the first few lines from Imo would still work in a script with directory paths included:
echo $LINE |sed "s#$input_dir_root#$output_dir_root#"
If you replace # with / , the above would fail as sed would be confused with where the command ends. Test it out on your script and let us know...