I am trying to edit an assembly and I have a .fa file with the sequence I am looking at.
I am ultimately trying to create a .vfc file to look at errors in my sequence. I am using the script:

    bwa index draft1_assembly.fa

    bwa mem draft1_assembly.fa reads_1.fastq reads_2.fastq> draft1.sam
     
    samtools view -b -o draft1.bam -S draft1.sam

    samtools sort draft1.bam draft1.sorted 
    
    samtools index draft1.sorted.bam
    
    samtools faidx draft1_assembly.fa
    
    samtools tview draft1.bam draft1_assembly.fa
    
    samtools mpileup -uf draft1_assembly.fa draft1.bam | bcftools call -vc –O v - >draft1_snps_indels.vcf

I have successfully created a .sam file using:

    $bwa index H_vit_Rb.fa
    
    $bwa mem H_vit_Rb.fa reads_1.fastq reads_2.fastq> H_vit_Rb.sam

I then successfully created a .bam file using:

    $samtools view -b -o H_vit_Rb.bam -S H_vit_Rb.sam

But when I try to create a .sorted file using:

    $samtools sort H_vit_Rb.bam H_vit_Rb.sorted

This message appears, not letting me create a .sorted file

    [bam_sort] Use -T PREFIX / -o FILE to specify temporary and final output files
    
    Usage: samtools sort [options...] [in.bam]
    
    Options:
     
     -l INT     Set compression level, from 0 (uncompressed) to 9 (best)
      
    -m INT     Set maximum memory per thread; suffix K/M/G recognized [768M]
      
    -n         Sort by read name
      
    -o FILE    Write final output to FILE rather than standard output
     
     -T PREFIX  Write temporary files to PREFIX.nnnn.bam
      
    -@, --threads INT
    
      Set number of sorting and compression threads [1]
         
     --input-fmt-option OPT[=VAL]
    
    Specify a single input file format option in the form of OPTION or OPTION=VALUE
      
    -O, --output-fmt FORMAT[,OPT[=VAL]]...
                  
     Specify output format (SAM, BAM, CRAM)
          
    --output-fmt-option OPT[=VAL]
                  
     Specify a single output file format option in the form of OPTION or OPTION=VALUE
          
    --reference FILE
     
    Reference sequence FASTA FILE [null]

What does this mean and how do i fix it?
Based on the usage in the error it's quite clear:

You use `$samtools sort H_vit_Rb.bam H_vit_Rb.sorted` and you should use `samtools sort H_vit_Rb.bam > H_vit_Rb.sorted` since the result is by default written to stdout. So add the redirection...