Confusion in subarrays

what is the use of j and k 2 different loops ? k purpose not clear.

i & j are solving the purpose are the pointers at 2 ends from where we need to start the array to the end position

the loop of k is to simply print the values of at the kth index of array