Word application scope issue

Hello everyone ,

I am facing an issue while writing the data to the word document . I am trying to write a data table to the word document and save it with dynamic name format .

Here I was able to write the datatable to the document and save it with dynamic name.

I have used a template word file to pick for each iteration , the problem here is even though i was able to save the file with dynamic file name with the required data , The bot/word application scope is somehow saving the data to the template file .

So this is causing an issue , like if I am writing the second iteration data table , since the first data table is already existing in the template file it is appending second datatable also .

Can anyone please let me know the issue .