When i am running the command to build the teal file it is giving error for the loop.
Welcome to Algorand @shivam!
For the community to be able to help you, could you please give a minimum example that creates the issue?
Have you looked at Control Flow — PyTeal documentation