Not able to connect to Wireless network in Ubuntu 20.04

I am using Asus TUF FX505DT with the Wireless interface Realtek RTL8822BE 802.11a/b/g/n/ac WiFi adapter.
It sometimes stops displaying the available Wireless networks and sometimes it displays the available networks but I am not able to connect to any network and it keeps on asking for the Wifi password again and again or keep trying to connect to the network.

$ sudo iwconfig
wlp4s0    IEEE 802.11  ESSID:off/any  
          Mode:Managed  Access Point: Not-Associated   Tx-Power=20 dBm   
          Retry short  long limit:16   RTS thr:off   Fragment thr:off
          Encryption key:off
          Power Management:on
$ lspci 
04:00.0 Network controller: Realtek Semiconductor Co., Ltd. RTL8822BE 802.11a/b/g/n/ac WiFi adapter (rev ff)
$ sudo lshw -C network
 *-generic
       description: Wireless interface
       product: RTL8822BE 802.11a/b/g/n/ac WiFi adapter
       vendor: Realtek Semiconductor Co., Ltd.
       physical id: 0
       bus info: pci@0000:04:00.0
       logical name: wlp4s0
       version: ff
       serial: dc:f5:05:b1:8f:81
       width: 32 bits
       clock: 66MHz
       capabilities: bus_master vga_palette cap_list ethernet physical wireless
       configuration: broadcast=yes driver=rtw_pci driverversion=5.4.0-37-generic firmware=N/A latency=255 link=no maxlatency=255 mingnt=255 multicast=yes wireless=IEEE 802.11
       resources: irq:69 ioport:d000(size=256) memory:f7700000-f770ffff

Go to Source
Author: Somil Singla