Your two examples look identical, which makes problems hard to diagnose. Potential problems:
-
You may need double quotes, as in
sed 's/xxx/'"$PWD""https://stackoverflow.com/"
-
$PWD
may contain a slash, in which case you need to find a character not contained in$PWD
to use as a delimiter.
To nail both issues at once, perhaps
sed 's@xxx@'"$PWD"'@'