How to annotate gene length to a list of gene symbols using UCSC data?
You could do a few command-line operations to answer this question. This assumes the use of hg38 assembly.
First, get a list of genes from GENCODE:
$ wget -qO- ftp://ftp.ebi.ac.uk/pub/databases/gencode/Gencode_human/release_28/gencode.v28.annotation.gff3.gz \
    | gunzip --stdout - \
    | awk '$3 == &quot;gene&quot;' - \
    | convert2bed -i gff - \
    &gt; genes.bed

Then use grep to filter those genes with your list of HGNC symbols:
$ grep -wFf hgnc_symbols.txt genes.bed &gt; filtered_genes.bed

You can run this through awk to get lengths:
$ awk -vFS="\t" '{ print $3-$2 }' filtered_genes.bed &gt; filtered_gene_lengths.txt