Showing runtime error

The code is showing runtime error ,I am not able to find out the error
Ques is:Given a singly linked list of integers, reverse the nodes of the linked list ‘k’ at a time and return its modified list.
Example:
1
1 2 3 4 5 6 7 8 9 10 -1
4
Output: 4 3 2 1 8 7 6 5 10 9
What’s the error in my code?

#include <stack>

Node *kReverse(Node *head, int k)
{   stack<Node*> s;

    
    if(head==NULL)
    {
       return NULL;
    }
 else
 { int count=0;
    while(count!=k || head!=NULL)
    {
       s.push(head);
        head=head->next;
        count++;
    }
    
    Node *head2=s.top();
    s.pop();
    Node *temp=head2;
    
    while(!s.empty())
    {
        temp->next=s.top();
        temp=temp->next;
        s.pop();
    }
    temp->next=kReverse(head,k);
    return head2;}
    
    
	
}