If I search a document in SharePoint Search, I am getting two files with different names, but the link/path to the documents are the same. Kindly help to solve this confusion.
If I search documents in Library, I get only two documents.
I would start by switching to the OOB Display Template rather than the custom one to rule out an error with your custom Display Template.
This looks like a Document ID issue. Sometimes SharePoint issues a non-unique Doc ID. It helps if you state SharePoint Version as well.
This is a solution you can already find on this Forum: