I got it, with some other logic.
I had to redefine global variable while inside the thread, then increase it.
@ocorex, console.log() which outputs information to the BAS log, has only one argument, use console.log(`Link: ${link}`) or util.format()