Do you have the Touchbar or non-Touchbar model?
If your WiFi connection dropped, then try connecting the laptop directly to the router using an Ethernet cable and a USB-C Thunderbolt 3 to Gigabit Ethernet Adapter. Otherwise you will need to figure out why the laptop disconnected from the WiFi which will most likely be difficult.
If you have access to another Mac for Late-2009 to 2023, then you can create & use a bootable macOS USB installer instead. To create a bootable macOS 10.13 USB installer, you will generally need a Mac from Late-2009 to 2018. For creating a macOS 13.x USB installer you generally need a Mac from 2017 to 2023. You can use the information in this article to determine which versions of macOS are compatible with various Apple hardware to determine a Qualifying Mac for creating a specific macOS USB installer:
https://eshop.macsales.com/guides/Mac_OS_X_Compatibility
Why are you reinstalling macOS? If it is to solve an issue, then perhaps that issue is the same one causing problems with reinstalling macOS.