loop creation Imacros

I apologize for my English.

I have two JavaScrypt scripts in Imacros. Separately, each one executes its own loop and works without any problems.
But for the fifth day in a row I am trying to combine these two scripts into one. to automate this process. but unfortunately I am failing again and again. for this reason I started to study JavaScrypt. my head is spinning.

Script1. It works with links.

var macro;
macro =  "CODE:";
macro +=  "SET !EXTRACT_TEST_POPUP NO" + "n"; 
macro +=  "SET !ENCRYPTION NO" + "n"; 
macro +=  "SET !ERRORIGNORE YES" + "n"; 
macro +=  "'Подключаем наш файл" + "n"; 
macro +=  "SET !DATASOURCE D:\iMacros\Datasources\Ok\URLs.csv" + "n"; 
macro +=  "SET !DATASOURCE_COLUMNS 1" + "n"; 
macro +=  "'данные с нужной строки" + "n"; 
macro +=  "SET !DATASOURCE_LINE {{i}}" + "n";
macro +=  "URL GOTO={{!COL1}}" + "n"; 
macro +=  "WAIT SECONDS=2" + "n"; 

for(i=1;i<=34;i++)

{ 
iimSet("i",i)
iimPlay(macro)
}

script2 goes to the link that script1 pulled out.

var macro;
macro =  "CODE:";
macro +=  "FILTER TYPE=IMAGES STATUS=ON" + "n"; 
macro +=  "TAG POS={{i}} TYPE=A ATTR=CLASS:link__91azp<SP>photo-link__79ad9<SP>__primary__91azp*     EXTRACT=HREF" + "n"; 
macro +=  "'PROMPT {{!EXTRACT}}" + "n"; 
macro +=  "TAB OPEN" + "n"; 
macro +=  "TAB T=2" + "n"; 
macro +=  "URL GOTO={{!EXTRACT}}" + "n"; 
macro +=  "WAIT SECONDS=5" + "n"; 
macro +=  "EVENT TYPE=KEYPRESS SELECTOR=* KEY=35" + "n";
macro +=  "WAIT SECONDS=2" + "n"; 
macro +=  "TAB CLOSE" + "n"; 
for(i=1;i<=20;i++){ 
iimSet("i",i);
iimPlay(macro);
}
iimPlay(macro)
 

and this script2 visits the profiles of the members of this link.
I put 20 people.

As I said both scripts perform their functions well, but only separately. my task is to combine these two scripts into one script.
script1 pulled a link – script2 visited 20 people – script1 pulled a second link – script2 visited 20 people and so on….
I would appreciate your help.

The maximum I could come to is that script1 loads the first link of 34 links. script2 visits only 1 person out of 20 people and the cycle starts over again. that is, script1 extracts the second link and script2 visits the second person and so on. And I want everything to be cyclic. i.e. script1 extracted the first link – script2 went through 20 profiles then the cycle starts over again where script1 extracts the second link and script2 continues to visit 20 profiles and so on…..