How to insert text into first line of the file and middle of the file?

Script 1
Pre-requisites
Create a file with x amount of lines in it, the content of your choice.

Write a script that takes two arguments. The first being a line of text, the second being your newly created file. The script should take the first argument and insert it into the very top (the first line) of the file named in your second argument.

Note! The file must retain the original name

Script 2

Take a copy (backup) and amend the above script so that it now inserts the first argument into the middle of the file.

No homework questions please. Read the rules. Rule #6 in particular. Thread locked.

Script 1
Pre-requisites
Create a file with x amount of lines in it, the content of your choice.

Write a script that takes two arguments. The first being a line of text, the second being your newly created file. The script should take the first argument and insert it into the very top (the first line) of the file named in your second argument.

Note! The file must retain the original name

Script 2

Take a copy (backup) and amend the above script so that it now inserts the first argument into the middle of the file.

just now similiar thread was closed