Couple of suggestions:
- don't use the '-r' option with 'rm' as you don't need it and if there's a bug in your script, potentially catastrophic
- Use https://www.shellcheck.net/ (or the similarly named tool from your Linux distro if you have it) to check your script for errors/warnings and fix them. BEST TOOL EVAR!
You may want to change the first line to '#!/bin/sh' as otherwise shellcheck will assume you use actual bash, which isn't included in LE. - Use 'mktemp' to create a temporary file(name), store that in a variable (I'll use 'TMP_DL_FILE')
- use 'wget ${DOWNLOAD_URL} -O ${TMP_DL_FILE} to store 'index.html' as ${TMP_DL_FILE}
- process ${TMP_DL_FILE} as you now used 'index.html'
- when done with it, do "rm -f ${TMP_DL_FILE}"
- Using, and after use cleaning up, your own file doesn't interfere with a potentially existing file with the same name. 'index.html' is far more common then what 'mktemp' produces
- 'Advanced' tip: try to put the various (distinct) functionality in their own function ('check_for_updates', 'download_update', etc) (so things aren't in the 'global namespace')