Hi @Khushboo Kumari,
Thank you for posting in this community.
I am sorry that we have to open the office document in another web page. This is designed by SharePoint, and we can't change it. SharePoint is only for managing the document. For reading or editing office documents we rely on the apps in Microsoft 365(like Word, Excel etc.).
Also, you can see that the document open URL includes Doc.aspx. which indicates that the Office file needs to be opened on this particular page and not on a SharePoint site page (That is why we will open the new page in another web page).
Also, I noticed that your second image gives away your domain name, please modify the image to encode the domain name for your safety.
Please accept any inconvenience this may cause. Thank you for your kind understanding. If there is any other assistance I can provide, please feel free to let me know.
If the answer is helpful, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.