Help me in solving SESO23 problem

My issue

On submitting this it shows as wrong answer

Rearrange the following code

for i = 1 to length(A) - 1

key = A[i]

j = j - 1

while j >= 0 and A[j] > key

A[j + 1] = A[j]

j = i - 1

end while

A[j + 1] = key

end for

Learning course: Searching and Sorting Algorithms
Problem Link: Insertion Sort in Searching and Sorting Algorithms