Here’s how to modify a line in a file using sed.

sed -i 's/replace me.*/with this text/' /path/to/a/file.txt