I spoke with Apple chat support. They did not have a solution for this issue.
My tested and working solution is as follows:
I bought 2 things
- HDMI Cable (one end connected to external monitor)
- USBC to HDMI converter (one end connected to macbook)
Now, the macbook does not charge because of external monitor connection.