Sed Shell - Replace an entire line number with a string
sed -i 'Ns/.*/replace-line-with-this-string/' file.txt
in N you enter the line number. Please add your string in "replace-line-with-this-string".
If you use a variable use this command:
sed -i "Ns%.*%$variable%" file.txt
Here % is the delimiter instead of /