Why can't this be done like converting BT to doubly linked list?

Why can’t we keep a global pointer prev and just just do inorder and seet prev->next=root and then assign prev=root.

This method is similar to what was discussed in question- convert BT to doubly linked list

yes you can do in that fashion as well

this is the code for that