Try the following:
Your original file
$ cat <<'EOF' > filenamefile.txt old_line101 line old_line201 line old_line302 line EOF02 line EOF insert into line 3 using a heredoc.
$ cat <<'EOF' | sed -i "2r"3r /dev/stdin" filenamefile.txt new_line1 new_line1text to insert EOF you get this result
$ cat filenamefile.txt old_line101 line old_line201 line new_line1text to insert new_line102 line old_line302 line UPDATED: Following the comment of @Kusalananda