How can I convert markdown files contains relative link with end with *.md to hugo links?

You cannot use markdown into markdown in such way.

When Hugo generating pages it using markdown files to generate html output (or other)

If you want to link to other page, you need to link to page URL as if it was live website.

That’s the Markdown way, not Hugo.

The Hugo method is described here

Example

{{< ref "document2.md#anchor" >}} 
1 Like