Get the strings you need from a file, sort the strings, and then save it into another file.
cat 10000ACRB_wm_pdf.xsl | sed 's/RefID/RefID\n/' | grep RefType | sed 's/.*RefType/RefType/' | sed 's/RefType=./RT_/' | sed 's/.].*//' | sort | tee ACRB_RefTypes.txt
Read the new file line by line and then add strings you need.
while read line
do
if echo ${line} | grep -q ${preline}
then
equal=${line}
else
preline=${line}
echo ${line}
fi
done < ./ACRB_RefTypes.txt |
sed 's/RT_//' |
awk '{print "Map(XPath(\"/PmtRec/*s/RefInfo/*s/RefID\"), XPath(\"/DocMap/*s/ACRB_RefTypes/*s/RT_"
$0
"\"), [], \""
$0
"\")," }'