This message is not an error. It may be posted to stderr, but it is just telling you the final steps of the sorting (samtools sort splits the reads, sorts these subsets, then merges the sorted subsets) are taking place. If this is accompanied by another message containing the word 'error' or something alike, then it's of course a different situation. If this is the only message, you should have a sorted bamfile after the job finishes.
If you just want to convert bam to sam, you can do
samtools view -h $bamfile.