sed -i edits a file in place, and there is no undo. Adding a suffix to the flag makes sed save the original first.
sed -i.bak 's/old-host/new-host/g' config.txt
After this, config.txt has the change and config.txt.bak is the file as it was. The attached form -i.bak works with GNU sed and with the BSD sed on macOS. Plain -i does not: on macOS it wants a suffix argument, which is why sed -i 's/a/b/' file fails there.
I would still run the command without -i first, since it prints the result to the screen and changes nothing.
Further reading: GNU sed manual