'exit 0 is not working inside jenkin shell

i am using while loop inside jenkins stage, below is the code. Issue is with elif [ $siteStatus = "SUCCEEDED" ] statement. once this statement is true i want this step to be completed and go to next step. which is not happening, it again going into loop.

while(currtime < futtime){
                        date = new Date()
                        currtime = date.getTime()

                        sleep(5);
                        sh """
                        export siteStatus= SUCCEEDED
                        
                        if [ \$siteStatus = "IN_PROGRESS" ]
                        then
                         continue
                        elif [ \$siteStatus = "SUCCEEDED" ]
                        then
                         exit 0 
                        else
                         exit 1
                        fi


Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source