There are not normally 78 lines in config.txt, at least not by default. So the condition will never be met and the insertion never made. If you would like to append to the file, try something like this to insert or append on the final line:

Yes, you can append using either sed or as shell redirection. Both methods are shown above. An advantage of using sed with -i is that it can create a backup file. The advantage of the appending redirection >> is that it is simple.

Can you please say a little about your task? Depending on the context there might be something else important.

Yes, you can append using either sed or as shell redirection. Both methods are shown above. An advantage of using sed with -i is that it can create a backup file. The advantage of the appending redirection >> is that it is simple.

If adding multiple lines from the shell, its common to use something called a "here document":-