Showing wrong ans but passes testcase

#include<bits/stdc++.h>
using namespace std;
class node{public:
int data;
nodeleft;
node
right;
node(int d)
{
data=d;
left=NULL;
right=NULL;

}

};
node* insert(node*root,int d)
{
if(root==NULL)
return new node(d);
if(d<=root->data)
{
root->left=insert(root->left,d);
}
else
root->right=insert(root->right,d);

}
node* build()
{
int n;
cin>>n;
int arr[n];
for(int i=0;i<n;i++)
cin>>arr[i];
int d;
node*root=NULL;
for(int i=0;i<n;i++)
{
d=arr[i];
root=insert(root,d);
}

return root;
}
void sumrange(node*root,int k1,int k2)
{

if(root==NULL)
return ;
if(root->data>k1)
sumrange(root->left, k1, k2);
if(k1<=root->data && k2>=root->data)
cout<data<<" ";
if(root->data<k2)
sumrange(root->right,k1, k2);
}

int main() {
int t;
cin>>t;
while(t–)
{

    node*root=build();
       int k1,k2;
    cin>>k1>>k2;
    sumrange(root,k1,k2);

}
return 0;

}

what s wrong in this ??

@aggarwalrishab07
save your code on ide and share it here with problem statement

https://ide.codingblocks.com/s/68007

problem statement
https://online.codingblocks.com/player/7457/content/5300?s=1463 i.e. Print BST keys in the given range

@jaiskid your buildtree function is not correct you have given that how many time you have take node data but you are doing only when your data is not equal to -1

sorry i pasted wrong ide link
this is my soln
https://ide.codingblocks.com/s/68010

@aggarwalrishab07 there is a lot of mistake in your code i have corrected you code you can refer this.