FIrebase Data Pagination

HI, I am trying to paginate my data from Firebase Database. I am trying to get all posts by a user limiting to 5. I want to use Infinite Scroll in my WebApp (currently writting backend code on Node using Firebase Functions).

Here is the link to the query I wrote:

Any help is greatly appreciated