Unable to understand how to write the output in given format

my output is correct but i am Unable to understand how to write the output in given format
code:
#include
#include
using namespace std;
class node{
public:
int data;
nodeleft;
node
right;

node(int d){
    data=d;
    left=NULL;
    right=NULL;
}

};
node* buildtree(){
int d;
cin>>d;
if(d==-1){
return NULL;
}
node* root=new node(d);
root->left=buildtree();
root->right=buildtree();
return root;
}

//height of tree
int height(node* root){
if(root==NULL){
return 0;
}
int ls=height(root->left);
int rs=height(root->right);
return max(ls,rs)+1;
}
//kth level print
void printkthLevel(node* root,int k){
if(root==NULL){
cout<<" END ";
return ;
}

if(k==1){
    cout<<root->data<<" ";
    return;
}
printkthLevel(root->left,k-1);
cout<<" => ";
printkthLevel(root->right,k-1);
cout<<" <= ";
return;

}
//print all levels
void printAllLevels(node* root){
int h=height(root);
for(int i=1;i<=h;i++){
printkthLevel(root,i);
cout<<endl;
}
return;
}
void bfs2(node* root){
queue<node*> q;
q.push(root);
//null
q.push(NULL);
while(!q.empty()){
node* f=q.front();
if(f==NULL){
cout<<endl;
q.pop();
if(!q.empty()){
q.push(NULL);
}
}
else{
cout<data<<",";
q.pop();

        if(f->left){
           q.push(f->left);
        }
        if(f->right){
           q.push(f->right);
        }
    }    
}
return;

}

node* buildfromPreandIn(int *ino,int pre,int s,int e){
static int i=0;
//base case
if(s>e){
return NULL;
}
//rec case
node
root=new node(pre[i]);
int index=-1;
for(int j=s;s<=e;j++){
if(pre[i]==ino[j]){
index=j;
break;
}
}
i++;
root->left=buildfromPreandIn(ino,pre,s,index-1);
root->right=buildfromPreandIn(ino,pre,index+1,e);
return root;
}

int main(){

int n;
cin>>n;
int pre[10000];
for(int i=0;i<n;i++){
	cin>>pre[i];
}
int m;
cin>>m;
int ino[10000];
for(int i=0;i<m;i++){
	cin>>ino[i];
}

node* root=buildfromPreandIn(ino,pre,0,n-1);
//bfs2(root);
printAllLevels(root);
return 0;

}

hi @anshita_1312, please remove unused code and send on ide.codingblocks.com