How to put the purchase code in the files

I have a product now, how do I make a purchase code for this product and put it in the file that I sell, and then how is a different purchase code sent to each person who buys the same product automatically anytime anyone buys the same product

You don’t need to worry! about that. Envato will manage the purchase code from their side. It is maintain/create by envato and is unique for each purchase.

Well, do I only put my project and they will put the purchase code in my project and the api and all these codes, or is there a code that I attach first to my project and then they manage all this?

about purchase code you don’t need to do anything. envato will add it when purchase will be done.

Ok, I understand the last question, please
Is that I just build my script and then just upload it and Code Canyon handles the licenses and the purchase code and all that?

License and purchase will be managed by envato. but if you like to add a verification process for your purchase then you have to do it from your side using envato api otherwise you don’t need to worry!