All perfect praise be to Allah, The Lord of the Worlds, and peace and blessing be upon the Messenger of Allah, his family, and all his companions.
So long as you accepted that gift and it became under your possession, you may benefit from it as you wish. You can gift it to other sick people, or you can sell it. Apparently, they mean that they did not issue these drugs for the purpose of sale, and it does not mean whoever possesses them has no right to sell them.
But if they explicitly stipulate that selling it is not allowed because that harms them, then you must abide by this condition. Then you either benefit from it yourself or give it to those who benefit from it, and you should not leave it until it is expired; otherwise, it will be a waste of money. Since the questioner sometimes writes to us in Arabic, we refer him for more benefit and details on the subject of the ruling on samples of medications that are given to doctors in the following fatwa 396010 in Arabic.
Allah knows best.