echo "Which directory \c"
read directory
tmpfile=/tmp/tmpfile.$$
for file in loaderconfiguration*.xml
do
sed "s|${directory}|$inName|g" $file > $tmpfile
mv $tmpfile $file
done
BEFORE you run this - where is the variable inName defined in your code? As is, it is null.
It needs to be set to something, somewhere, before the for loop.