I added a webpart using the below process
Export your content editor web part and get the schema XML and follow the steps given in this link. Programmatically add a web part to a page using CSOM
The content editor webpart I added is showing up on the pagem but not showing up on page edit.
I added on O365 site page through provider hosted app.