Problem with Script that writes max lines of a file - Any ideas how to fix?

xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx

You're setting $NUMBER equal to the first argument and then later in the script checking that the first argument is numerically zero. Is this intended? And if you are using an argument of 0, then that has to be a filename in the directory for the "linetest1=`wc -l < $NUMBER`" to work.
Change line 1 to

#!/bin/ksh -x

so you can see what each line is evaluated to before it's executed.

Jerry

Place some echo commands with your variables between the if statements and see what happens.
You also may run your script in debug mode, add the following line below the line #!/bin/ksh:

set -x

Another solution is:

wc -l /yourdir/* | grep -v total | sort -n | tail -1

Regards

xxxxxxxxxxxxxxxxxxxxxxxxx

NUMBER=$1
if [ $# -ne 1 ] # Verify that there is only one argument on the command line
then
echo "Error. Can only use 0 or 1 arguments."
echo "Usage: maxlines.sh [directory]."
exit 1
fi
flag=1
# If the number of positional parameters is equal to zero search through
# the current directory. No directory provided on the command line.
if [ $1 -eq 0 ]
then
for testfile in * # Loop through the entire directory (top to bottom)
do
echo $testfile
if [ -f $testfile ] # Test that the name is a file
then
linetest1=`wc -l < $testfile`
echo $linetest1
if [ $flag -eq 1 ]
then
startline=$linetest1
startfile=$testfile
flag=2
fi
#The script executes the following code after the first pass
if [ $startline -lt $linetest1 ]
then
startline=$linetest1
startfile=$testfile
fi
fi
done
echo "File $startfile has the most lines with $startline lines."
exit 0
fi