Running Executable in Bash Script

Hey guys, so I've been trying to write a bash script called runSorter.sh that runs an executable that also takes in some parameters and outputs the results to a text file. The executable, sorter, takes in a number parameter. I want to make it so that you can input as many number parameters into runSorter.sh as you want and it will run the sorter executable for each one. So far, what I have looks like this:

#!/bin/bash                                                                      
args=("$@")
INDEX=0

if [ -z args ]; then
       echo "Error"

else
       while [ $# -gt $INDEX ]; do
              NUM=${args[$INDEX]}
              echo $NUM
              echo ./sorter $NUM
              let INDEX=INDEX+1
       done
fi

My problem is that when I run ./run-sorter.sh 100 on my terminal, it just prints this to the screen:

./sorter 100

How can I have so that it properly executes sorter and outputs everything to a text file? Thanks in advance.

This works for me

#!/bin/bash
args=("$@")
INDEX=0
touch sorterfile
if [ -z $args ]; then
echo "Error"
else
while [ $# -gt $INDEX ]; do
NUM=${args[$INDEX]}
echo $NUM
echo ./sorter $NUM >> sorterfile
let INDEX=INDEX+1
done
fi

The problem with that solution is that it doesn't actually run the sorter executable. If you check sorterfile, all you'll find is ./sorter 100

Maybe I missed it but I didnt see a statement to actually run anything?

is this it?

echo ./sorter $NUM? >> outputfile

if yes then you have to do the following to actually run the sorter

`./sorter $NUM`>> outputfile

Oh, ok. Thanks a lot!