That code doesn't work as I have already uninstalled calibre.
Went for broke and edited your code with the code to install the new version and came up with..
sudo -v && wget -nv -O-
https://download.calibre-ebook.com/linux-installer.sh | sudo sh /dev/stdin version=4.23.0
Got 4.23.0 thanks.