One part of coinbase transaction is p2pkh ScriptPubKey (according to the book i read).
That is (or at least, was) commonly the case, but there is no such requirement.
Suppose i have all the data needed to build coinbase transaction (version,output,ect) except the p2pkh ScriptPubKey , and i have my address that i generate using bitcoin rpc getnewaddress , how do i generate the p2pkh ScriptPubKey ?
The coinbase transaction needs to have one or more outputs, which distribute the subsidy and fees gained to the miner(s). The miner can decide to pay out thenselves in whatever way they want. In that sense, the transaction outputs of the coinbase transaction are no different from those of any other output.
Now, most wallets want to be paid using one of the standard output types (P2PKH, P2SH, P2WPKH; there are a few more but that doesn't matter here). Each has a corresponding address type, so if you want the payout to such an address, you just need a way to compute the corresponding scriptPubKey. This is a very standard operation, implemented in pretty much any Bitcoin software library, and literally every wallet.
For P2PKH specifically, there are plenty of questions on how to do that on this site. For P2SH, refer to BIP13. For P2WPKH, see BIP141.
Extra question : when i generate new address using bitcoin rpc getnewaddress , is the generated address a public key or private key ?
Modern wallets won't generate P2PKH addresses anymore; they are legacy. But the same applies for other address types.
In general, first the private key is generated (usually deterministically using BIP32). Then the corresponding public key is computed. Then that public key is hashed, and the hash is encoded as an address (for P2PKH or P2WPKH; for P2SH or P2WSH a script is involved as well).