With your question edit, I see your problem. Let's say the current directory is /home/yourname
... in this case, your command below:
sed 's/xxx/'$PWD'/'
will be expanded to
sed `s/xxx//home/yourname//
which is not valid. You need to put a \
character in front of each /
in your $PWD if you want to do this.