Can company A transfer the shares into company B as assets?
Of course. Anyone (which includes Company A) can do what they like with their assets. They can sell them, gift them, pile them up douse them with petrol and set fire to them (subject to environmental law of course) etc. For example, many companies donate to charity.
The directors who authorise the dealing with assets have a fiduciary duty to act in the company's best interest but this is subject to a business judgement rule and is only an issue if shareholders object to their actions. Similarly, the company cannot dispose of assets in an attempt to defraud its creditors.
What's the tax implication?
Disposing of the shares will incur a capital gains tax liability for Company A. This will be at the greater of market value or whatever Company B paid for them. If Company B paid less than market value, the difference would be a gift from A to B and, unless B was a tax-deductable gift recipient like a charity, the gift would not be tax-deductible.
Whatever B paid would be the base value for their ultimate CGT liability when they dispose of them.
Therefore if B pays less than market value, the shares will ultimately be subject to some double taxation.