if the Porto template was applied on another site for the test, how do I apply this template on my main site?
To use purchase code again which already used for any website (mean theme license already registered) you have to unregister/deactivate the theme license from the old domian/website. you can use not the same purchase code for more than 1 website.
If you don’t have access of old website where the theme registered/activated then you have to contact theme author and request them to unregister/deactivate the theme license from the old domian/website.
contact theme Author and let them know How to Contact your purchased theme Author, theme author may help you.