How to merge k sorted arrays?

I have n sorted arrays of size n each and I have to merge them.
I am trying to implement this using priority queue as a min heap. Why am I getting wrong output.
Any suggestions . Here is my code:)

Please help me.
Thanks in advance.@aviroop123 @gvaibhav21 @vijju