Hello,
Can you please replace sort -k1,1 with sort-bed -? (Please include the hyphen.) I'm not sure why you get that error, but it does look like your data might not be sorted correctly, and so that is something you'd want to change, in any case.
You can use cat -te to check for both tab and newline characters. If your BED files come from Excel or Windows, there could be additional carriage-return characters in there that would cause problems with parsing.
If you can share the files BAM/Big_Data_ref.fa.bed and Big_Data_ref_mappability.wig.bed, that would be helpful, as well as what version of the toolkit you are using, and on what platform you're running things.