Getting or Building coinbasetxn to create the Merkle Root
The coinbasetxn is a field that results from a request from a pool. Have you seen this link here? How to compute merkle root without coinbasetxn?

You are hitting your local block chain node which will give you the actual individual transactions in the transactions field. You can then use all the fields to create the coinbasetxn yourself. 

To build it yourself, I recommend reading example/actual code in another language in conjunction with the docs. Check out this link: https://www.anintegratedworld.com/whats-in-a-block/ where you can read the wikipedia links and also see graphically the internals of a block.