sed -i $sedcommand/.*/"$newline"/ $location
The variable "line" should be the actual line number you want to replace. The above format is necessary otherwise (to break the "$line"s into it's own variable for it to work.
sed, linesedcommand, quot, sedcommand, newline, variable, format,