Hello, this service is not meant for legal advice.
However, on a general note, I would not recommend the course of action that you are planning.
As you are aware of, melatonin was classed as a medicine and is only available on prescription in the UK.
One thing is the possibility to buy melatonin in a foreign country where it is considered a supplement and to bring it to the UK for personal use.
A completely different thing is to plan to sell it online with a Uk registered company, basically circumventing the law.
Importing human medicines (including unlicensed medicines) requires a licence and even if the product is delivered directly from the manufactures it doesn't change that the UK company will be selling it.
Also, the e-commerce platforms policy is to try to prevent the online free sale of products in countries where they can be available only on prescription (https://www.theguardian.com/money/2018/jan/03/illegal-sale-melatonin-ebay)
At any rate, I have to recommend that you speak with a specialist solicitor for a thorough assessment of the case and advice on the possible legal consequences.
I hope this information is helpful and I wish you the best.
Please do not hesitate to contact JA again if you need help and you may ask to speak with me directly if you wish.