Create prototype reactions

Hello, I am very new to Figma API and javascript, this is my first plugin, so while this might be obvious to you, its not for me, so I would really appreciate your help.
Im trying to do text typing animation plugin. See what I mean
I decides to use interactive components. It will generate different “frames” of the animation and than it will connect them all through interactions to create a seamless video (obviously not real video, its in figma)


I think I got very close, but not close enough, it still throws an error: TypeError: ‘0’ is read-only

function clone(val) {
    const type = typeof val
    if (val === null) {
      return null
    } else if (type === 'undefined' || type === 'number' ||
               type === 'string' || type === 'boolean') {
      return val
    } else if (type === 'object') {
      if (val instanceof Array) {
        return val.map(x => clone(x))
      } else if (val instanceof Uint8Array) {
        return new Uint8Array(val)
      } else {
        let o = {}
        for (const key in val) {
          o[key] = clone(val[key])
        }
        return o
      }
    }
    throw 'unknown'
  }
let i = 1

let currentEditingVariant = figma.currentPage.findOne(n => n.name === "Property 1=Jak se máš?-" + i + "-frame")
figma.currentPage.selection[0] = currentEditingVariant
console.log("currentEditingVariant")
console.log(currentEditingVariant)

while (i < 22) {

    let destinationVariant = figma.currentPage.findOne(n => n.name === "Property 1=Jak se máš?-" + i + 1 + "-frame")
    console.log("destinationVariant.id")
    console.log(destinationVariant.id)
    console.log("destinationVariant")
    console.log(destinationVariant)

    const reaction1 = clone(currentEditingVariant.reaction)
    console.log(currentEditingVariant.reaction);
    
    console.log("reaction1")
    console.log(reaction1) 

    destinationVariant.reactions = reaction1
    
    console.log("Loop " + i + "done")
    i++
}

Suggestions appreciated!