Retrieve getDownloadableProductLinks() from the Product object in Magento 2 to fetch download product links information.
Core module module-downloadable contains the extension attributes type for the Magento\Catalog\Api\Data\ProductInterface. Attribute code downloadable_product_links used for the links details in the product object.

When `get($sku)` fails with `NoSuchEntityException` then `$linksData` returns null, not array.
`$linksData = [];` should be located BEFORE `try {`
Updated the $linksData array. thanks.
Can we directly call a model method from the template using $this ?
No, You need to create Block Class to directly call the method. I have used Model class, you need to call model funnction to the Block class and call block method to the templates.
Okay, thanks for the clarification.