Try altering your sed
delimiter so that it is not a forward slash:
sed "s~URLS~$TEXT~g" imagesbu.html > images.html
Edit: Your original sed command doesn't work because of the above, and because you are trying to replace a single word with multiple lines. Try awk
instead:
awk -v u="$TEXT" '{gsub(/URLS/,u)}1' imagesbu.html > images.html