For loop can't generate xml elements with varying contents

I was trying to make a ProPresenter 6 Presentation file (or .pro6) generator from either a short or long string input. For some reason, the for loop did not do its job correctly. The for loop should generate another xml tag named "RVDisplaySlide" with the same tags and contents parsed from a template .pro6 file, then replaces the contents with the string input.

For a short string input, it works as it would generate one "slide" tag. However, for long string inputs, which would get split to a list of "fit-able" strings for the "textbox element", it generated the same tags WITH THE SAME content as the first one did.

The full code can be found in this hastebin link: https://www.toptal.com/developers/hastebin/hidefogizi.py

For now, to simplify how the problem looked like, I commented the codeblock that would generate the content and left the code that should generate different uuid values to the elements. The output is similar still.

Here's an example of what I meant:

>>> a = ToPro6("""[Connection Terminated]
I'm sorry to interrupt you, Elizabeth, if you still even remember that name, but I'm afraid you've been misinformed. You are not here to receive a gift, nor have you been called here by the individual you assume, although, you have indeed been called. You have all been called here, into a labyrinth of sounds and smells, misdirection and misfortune. A labyrinth with no exit, a maze with no prize. You don't even realize that you are trapped. Your lust for blood has driven you in endless circles, chasing the cries of children in some unseen chamber, always seeming so near, yet somehow out of reach, but you will never find them. None of you will. This is where your story ends.

And to you, my brave volunteer, who somehow found this job listing not intended for you, although there was a way out planned for you, I have a feeling that's not what you want. I have a feeling that you are right where you want to be. I am remaining as well. I am nearby. This place will not be remembered, and the memory of everything that started this can finally begin to fade away, as the agony of every tragedy should.

And to you monsters trapped in the corridors, be still and give up your spirits. They don't belong to you. For most of you, I believe there is peace and perhaps more waiting for you after the smoke clears. Although, for one of you, the darkest pit of Hell has opened to swallow you whole, so don't keep the devil waiting, old friend.

My daughter, if you can hear me, I knew you would return as well. It's in your nature to protect the innocent. I'm sorry that on that day, the day you were shut out and left to die, no one was there to lift you up into their arms the way you lifted others into yours, and then, what became of you. I should have known you wouldn't be content to disappear, not my daughter. I couldn't save you then, so let me save you now. It's time to rest - for you, and for those you have carried in your arms. This ends for all of us.

[End Communication]""", "fnaf6_speech")

>>> a.save("..")
<Element 'array' at 0x0000018847E9BA10>
'Succeed'

XML output:

...
    <RVSlideGrouping name="" color="1 1 1 0" uuid="709FF810-7A39-46AD-8A4E-03E592A0AFB1">
      <array rvXMLIvarName="slides">
        <RVDisplaySlide backgroundColor="0 0 0 1" highlightColor="" drawingBackgroundColor="false" enabled="true" hotKey="" label="" notes="" UUID="0380C4D4-FD26-4768-9612-28AEE0C05894" chordChartPath="" />
        <RVDisplaySlide backgroundColor="0 0 0 1" highlightColor="" drawingBackgroundColor="false" enabled="true" hotKey="" label="" notes="" UUID="0380C4D4-FD26-4768-9612-28AEE0C05894" chordChartPath="" />
        <RVDisplaySlide backgroundColor="0 0 0 1" highlightColor="" drawingBackgroundColor="false" enabled="true" hotKey="" label="" notes="" UUID="0380C4D4-FD26-4768-9612-28AEE0C05894" chordChartPath="" />
        <RVDisplaySlide backgroundColor="0 0 0 1" highlightColor="" drawingBackgroundColor="false" enabled="true" hotKey="" label="" notes="" UUID="0380C4D4-FD26-4768-9612-28AEE0C05894" chordChartPath="" />
        <RVDisplaySlide backgroundColor="0 0 0 1" highlightColor="" drawingBackgroundColor="false" enabled="true" hotKey="" label="" notes="" UUID="0380C4D4-FD26-4768-9612-28AEE0C05894" chordChartPath="" />
        <RVDisplaySlide backgroundColor="0 0 0 1" highlightColor="" drawingBackgroundColor="false" enabled="true" hotKey="" label="" notes="" UUID="0380C4D4-FD26-4768-9612-28AEE0C05894" chordChartPath="" />
        <RVDisplaySlide backgroundColor="0 0 0 1" highlightColor="" drawingBackgroundColor="false" enabled="true" hotKey="" label="" notes="" UUID="0380C4D4-FD26-4768-9612-28AEE0C05894" chordChartPath="" />
      </array>
    </RVSlideGrouping>
...

As you can see, it generated the same uuid for each element. Is there a way to fix this?

How many English words
do you know?
Test your English vocabulary size, and measure
how many words do you know
Online Test
Powered by Examplum