Adding result from Javascript to bubble database items

I have been stuck in this for a long time now, and some help would be appreciated. My issue is the following:

I am running a Javascript code through the toolbox plugin, and this code returns a list of numbers (106 numbers).

I want to add the corresponding number to every one of those items which i already have in my database (so to item 1 in the field “Number” make it equal to the 1st item on the returned javascript list) but i have some issues.

  1. I was trying to do it through an api workflow, yet this means saving these values in a temporary variable as the api workflows cannot access elements from the index

  2. When trying to save this in a temporary variable, all repeated items get erased, so now i have 40 items instead of 106

what can i do to solve this?