Hi,
The download controller requires a file entry in the hikashop_file table and based on how the file is configured, it requires an order id of an order with the corresponding product purchased.
So supposing that you add the sample fiel as a "free download" file in the product backend edition interface, you'll get the URL you need to use on the frontend product page.
Supposing that you're editing a view file of the product page via the Display>Views menu, in the variable $this->element->files you have an array of all the free download files of the product.
So you can output the links like that:
foreach($this->element->files as $file) {
echo $file->download_link;
}
And if you want to generate that download link elsewhere, you can do it like that:
hikashop_completeLink('product&task=download&file_id=' . $file->file_id.$url_itemid);