Help me in solving AO14 problem

My issue

I got correct while “run” but “wrong answer” is coming while submit

My code

# The code below is incorrect. Debug this code to solve the problem

t=int(input())
for i in range(t):
    n=int(input())
    arr=list(map(int, input().split()))
    temp=0
    final=0
    i=0
    while i<(n-1):
        temp=arr[i]+arr[i+1]
        if temp>final:
            final=temp
        i=i+1
    print(final)

Learning course: Python with Data structures
Problem Link: CodeChef: Practical coding for everyone