How do I generate the cursor pagination in axios

So more or less I have the code what is complicated for me is to make the loop and I do not understand much that code calls the function again to get the cursor but I do not fully understand