writing string to specific line

I want to put a text string in file using any method on specific line

line number 30

text to be put %this is location /var/www/filename

something like this :

awk -v c=30 'NR==c {$0="text want to put"}1' input >> output

Try this:

    sed '123 i Texto a insertar'  fichero >> salida.txt

123 is your specific line .

Hi

I like sed command its not working and what the logic behind it