A script that draws a line across the screen needs to know how wide the screen is.
read -r rows cols <<< "$(stty size)"
printf '%s rows, %s columns\n' "$rows" "$cols"
tput cols
stty size prints rows first and columns second, and reads them from the terminal on standard input. tput cols and tput lines give single values. In bash, the variables $COLUMNS and $LINES also hold them in interactive shells. stty size fails with an error when standard input is not a terminal, for example in a pipe or a cron job, so check the exit status in scripts.
Further reading: stty manual page