writing data in a text file at particular line

I need to write value of variable $version at a particular line in a text file.
Line number is determined by another variable &line......I don't know how to do it in shell script ...

What do you have so far and where exactly are you stuck?

Regards

do you mean something like this??

sed $line'{
a\
'$version'
}' filename