[bash help]Adding multiple lines of text into a specific spot into a text file

I am attempting to insert multiple lines of text into a specific place in a text file based on the lines above or below it.

For example, Here is a portion of a zone file.

                IN      NS      ns1.domain.tld.
                IN      NS      ns2.domain.tld.
                IN      NS      ns3.domain.tld.
                IN      NS      ns4.domain.tld.

        IN    A    255.255.255.255

I need to add 4 lines of MX records in between the final NS record and the first A record, and still leave 1 line of white space between each, so that it looks like this:

                IN      NS      ns1.domain.tld.
                IN      NS      ns2.domain.tld.
                IN      NS      ns3.domain.tld.
                IN      NS      ns4.domain.tld.

                 IN      MX      mx1.domain.tld.
                 IN      MX      mx2.domain.tld.
                 IN      MX      mx3.domain.tld.
                 IN      MX      mx4.domain.tld.

        IN    A    255.255.255.255

I've checked the other posts which have to do with inserting text into a file, and it seems like this can be done with some iteration of sed, but I'm not sure where to begin. the other examples of this kind of situation on this forum seemed to be dealing mostly with specific line numbers, or a static value to insert the line after. Where in this situation, the final NS record will change, and the amount of NS lines will change from zone file to zone file, so the only static value is the IN NS.

any help anyone can offer with this is greatly appriciated.

Try:

input:

cat file1
                IN      NS      ns1.domain.tld.
                IN      NS      ns2.domain.tld.
                IN      NS      ns3.domain.tld.
                IN      NS      ns4.domain.tld.

        IN    A    255.255.255.255
cat file2
                 IN      MX      mx1.domain.tld.
                 IN      MX      mx2.domain.tld.
                 IN      MX      mx3.domain.tld.
                 IN      MX      mx4.domain.tld.

Code:

awk '{ if(/A.+[0-9]+/) {_s=$0;next;} print;}END { print "\n" _s; }'  file1 file2
                IN      NS      ns1.domain.tld.
                IN      NS      ns2.domain.tld.
                IN      NS      ns3.domain.tld.
                IN      NS      ns4.domain.tld.

                 IN      MX      mx1.domain.tld.
                 IN      MX      mx2.domain.tld.
                 IN      MX      mx3.domain.tld.
                 IN      MX      mx4.domain.tld.

        IN    A    255.255.255.255

You can have the text to be insert in a file.Here I had the main file as "file1" and had the text in the file "file2".

file1:

  
                IN      NS      ns1.domain.tld.
                IN      NS      ns2.domain.tld.
                IN      NS      ns3.domain.tld.
                IN      NS      ns4.domain.tld.

                IN    A    255.255.255.255

file2:

                 IN      MX      mx1.domain.tld.
                 IN      MX      mx2.domain.tld.
                 IN      MX      mx3.domain.tld.
                 IN      MX      mx4.domain.tld.
str=""
while read line
do
        str="$str$line\n"
done < "file2"

while read line
do
        match=`sed -r "s/(^ *IN +A.+$)/$str\n\1\n/g" <<<"$line"`
        echo -e "$match" >>resultfile
done < "file1"
 Here the result will store on the file resultfile