When you store a file in Microsoft Teams it can be edited by anyone with access to it in real time. Sometimes this is desirable, such as when you want to collaborate on a file with others in real-time. When you need to prevent others from editing a file while you are making changes the check-out feature temporarily stops others editing the document until the person who has the file checked out checks it back in.
If you check out a file but you forget to save it, once you check the file back in your changes will not be saved. So if editing a checked-out file in a desktop app be sure to save it if you make changes that you intend to be written back to Teams once the file is checked in. In addition, if you choose to discard the checkout, even if you have saved the file, the changes will not be saved back to the library so be careful if this is not what you intend.
If you have the checked-out file open in one of the Microsoft 365 desktop apps, you can simply click the Check In... button on the yellow ribbon across the top of the document.
If you are editing the document in Teams: