replace multiple lines in file

Hello
I am a beginner in shell script.

I was trying to find a way to replace multiple lines of a file with different set of multiple line.

    sed -n '/begin/,/end/p'  < sample1.txt >test.txt
        UNEDITED=`cat test.txt`
 
       vi test.txt

          EDITED=`cat test.txt`
        echo "$EDITED"

echo `sed s/$UNEDITED/$EDITED/  sample1.txt`

i tried the above code, no need to say it fails.
can someone please help me.

I apologies if this question is been asked before i tried to look but couldn't find it

Gives us an example "before" and "after" file

This is the difficult part. This is supposed to be for an configuration file.
so lets say,

before:

SECTION_A
property1  attribute1="zzz", attribute2="aaa",
                  attribute3="ccc"

property2  attribute1="qqq", attribute2="aaa",
                  attribute3="xx"

SECTION_B
property3  attribute1="zxx", attribute2="aaa",
                  attribute3="c"

property4  attribute1="zzz", attribute2="aaa",
                   attribute3="ccc"
 

so there is "vi" command given for the file. so in this case the code for editing only the "section_a" of the configuration

    sed -n '/SECTION_A/,/SECTION_B/p'  < sample1.txt >test.txt
        UNEDITED=`cat test.txt`
 
       vi test.txt

          EDITED=`cat test.txt`
        echo "$EDITED"

echo `sed s/$UNEDITED/$EDITED/  sample1.m`

so in some sense i want to edit specific section of configuration file. save it it temp file. and then updated the edited section.

The whole point of going through this exercise was to give user chance to update only the section he wants and hiding the rest of configuration temporarily.