The best way to build endurance is to endure. The longer you endure this time, the longer you can endure next time.
So if you’re in the middle of something, and you’re ready to give up, just keep pushing through. If you’re stuck, keep moving. It takes endurance to build endurance.