Homebrew not detecting latest Xcode and Command Line Tools, and not uninstalling them either
As is evident from the output of brew config, your installation of Homebrew is pretty outdated. Also, as mentioned in your comment, you have a proxy active in your system. This explains why Homebrew installation is failing to connect unable to the Homebrew software's server counterpart via port 443, which  hosted on GitHub.

Follow the instructions in the following answer to update your installation of Homebrew to current version:


https://apple.stackexchange.com/a/232770/279727


If you run into an error similar to:


  Error: Permission denied


Run:

sudo chown -R `whoami`:admin /usr/local/share


to resolve it.

If you get the following error:


  Warning: Homebrew's sbin was not found in your PATH but you have installed 
  formulae that put executables in /usr/local/sbin. 
  Consider setting the PATH for example like so: 
  echo 'export PATH="/usr/local/sbin:$PATH"' >> ~/.bash_profile


Run the command-line mentioned in the last line.

Once you have Homebrew updated, run brew cleanup to remove any broken symlinks.

The current public version of Homebrew is 2.1.6. You can check if your installation of Homebrew is up-to-date by running brew config and matching the value with the HOMEBREW_VERSION: key in the output.