I tried that and it didn't fnish changing it because I lost connection with the router. so how am I supposed to change it if it doesn't complete the process
If the password change isn't completing then you're going to need to use a device that's connected with an Ethernet cable to change the password of the particular WiFi band (2.4GHz or 5GHz), or be connected to the opposite band of the one you're changing the password for.
Some changes will take when you're connected to the band you're changing, but others won't, and evidently, the password is one of the ones that won't.
AMD Ryzen 5 3400G | XPG SX8200 Pro 500GB M.2 NVMe SSD | Western Digital Blue 500GB HDD | 16GB Corsair DDR4-3000 | Windows 10 Pro 64-bit