Hello!
I personally think it is not illegal and does not constitute trademark infringement. As long as you use it yourself, it does not constitute infringement and you have not put the product into the market. Article 52, Paragraph 4 of the Trademark Law stipulates: Without the consent of the trademark registrant, the registered trademark is changed and the goods with the changed trademark are put into the market. This is a copyright infringement.
If you have any questions, please ask.