It's because, Salesforce files aren't hosted on your salesforce domain, instead if you download your file and check the source it will show something like,
https://<your-instance>-dev-ed--c.documentforce.com/sfc/servlet.shepherd/version/download/documentId?operationContext=S1
So either you need to trim down the URL like,
String documentId = Cd.ContentDocumentId;
String baseURL = URL.getSalesforceBaseURL().toExternalForm(). split ('-ed.')[0];
basURL+='c.documentforce.com/sfc/servlet.shepherd/version/download/'+documentId+'?operationContext=S1';
which you can try but i wouldn't recommend. Since their is a dedicated SObject to handle file URL's, the ContentDistribution.
Though, it isn't created automatically like ContentDocument when ContentVersion is created, instead either you create it manually or when the user clicks 'Public URL' under salesforce files.
So additionally you need to create ContentDistribution for your files if they're being shared publically.