It seems that 3rd party tools aren't very smart with CR character. You can easily work around this issue by using the following line:
In addition, I would recommend to save the file by using ASCII encoding, because not all tools support Unicode encoding for base64-encoded files (Add-Content uses Unicode by default).
$approvedcert.RawCertificate.TrimEnd() | Add-Content c:\temp\ssl\upload\$filename-Encoding ASCII