Merge sort in Linked List -- deep/shallow copy problem

I have tried solving this problem alot number of time but there is some problem with my code-
After debugging it i came to know that the problem is the linked list is not dividing into two even after setting mid->next = NULL
here is my code please correct me

@sy7176442_ca8a8991a7ddc322 why u take ofstream these things u just complicated your code can i give u code??

@sy7176442_ca8a8991a7ddc322 https://ide.codingblocks.com/s/653972 check this

I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.

On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.