Print bst keys in the given range

void printk1k2(node*root, int k1, int k2)
{
if (root == NULL) return;
if (root->data >= k1 and root->data <= k2) cout << root->data << " ";
printk1k2(root->left, k1, k2);
printk1k2(root->right, k1, k2);
}

why this ordering shows wrong o/p ??
preorder type shows wrong

and inorder type shows correct

hello @hg11110000

in question they want keys output in increasing order and becuase inorder on bst gives increasing order. it is working