Help me in solving LPYAS154 problem

My issue

what is wrong in 7th line

My code

# cook your dish here
N=int(input())
import math
def sum_of_factors(N):
    total_sum=0
    for i in range(2,int(math.sqrt(N)+1)):
        if N %i==0:
           total_sum+=i
           if i!=N//i:
               total_sum+=N//i
               return total_sum
               
           

Learning course: Algorithmic Problem Solving
Problem Link: https://www.codechef.com/learn/course/klh-problem-solving/KLHPS2401/problems/LPYAS154