The use case would be that a file is uploaded to Salesforce but it should be saved in Sharepoint. How do I do it
Is a very broad question. You can achieve this using number of different patterns. But in general, what you need is to integrate Salesforce with Sharepoint.
I saw a post about making a REST call and having that do the trick
That’s what you will need here. You will need to invoke the APIs provided by Sharepoint to create files as soon as they are created in Salesforce.
but I don't understand where should you run it?
Again, this is very broad. You can choose different ways here viz., a Middleware service picking up the files from Salesforce and writing it to Sharepoint or you write an Apex class within Salesforce which calls the Sharepoint REST APIs.
Would it be also possible to get the reference link back?
As long as Sharepoint APIs provides it, then Yes