To avoid duplicates by row use an array to mark the used values. Here is a modified version of your script:
for ((z = 1; z<=tickets ; z++)); do
i=0
used=( 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 )
for (( ; i<6; )); do
x=`echo $[ 1 + $[ RANDOM % 49 ]]`;
if [ ${used[$x]} -eq 0 ]
then
printf "\t $x";
i=$((i + 1))
used[$x]=1
fi
done;
printf "\n"
done;
printf "\n"; }
EDIT: Explanation.
The idea is very simple, we use the array to mark those values already used.
Initially all the elements (50 elements that corresponds to the values [0, 49]) of the array are set to zero, i.e. all the numbers are available.
For each random number x we check if that number is available (used[x] = 0), if so we increase the counter i and mark that value (used[x] = 1) to avoid repetitions.
If the value is already taken simply try again and again until an unused value is found.