Problem with Extract alignment ends

It depends on the tool used for mapping the samples; e.g. in order to include the NM tag when using RNA STAR, it should be specified in the BAM output format option.