sed -i '20s/^/SET search_path to sales,public;\n/' myfile.txt
If your string contains special characters, remember to escape it properly. In the next example, I want to append the string \timing at line number 7 in myfile.txt:
sed -i '7s/^/\\timing on\n/' myfile.txt