Hello Pradeep Gopal,
Thank you for reaching out to Microsoft Support!Using the Graph API, you cannot post a comment on a Word document as this feature is not supported at the moment. Please refer to the Q&A.
If you are looking to post a new comment in an Excel workbook using the Graph API, this is also not possible. However, you can post a reply to an existing comment in an Excel workbook using the Graph API. Please check documentation. Also please see the screenshot below for reference.
Hope this helps.
If the answer is helpful, please click Accept Answer and kindly upvote it. If you have any further questions about this answer, please click Comment.