Add for-next loop at beginning,
Embed rest of code in that loop and add
[[CYCLE_INDEX]] to {{link fo category}} like this >
{{link fo category}}[[CYCLE_INDEX]]
I don't know if i'm doing something wrong but if i put inside the "Read file" command an resource file path "lines from file" the function doesn't work
Doing so means that there is path to another file inside your original file.
Just use resource anywhere in your code.