So, I extracted my router's binary file with binwalk and got the filesystem. I made some changes to the WebUI of the router, and now I want to put it back together into a .bin file so that I can flash my router with it. How do I go about it?
According to the main developer of Binwalk, you can't and this is not a feature they will implement anytime soon. From the link:
This isn't a binwalk related question, as binwalk does not re-build binary images. However, you might want to take a look at the firmware mod kit, which uses binwalk for extraction and can re-build many router firmware images automatically (it may even work on this particular firmware): https://code.google.com/archive/p/firmware-mod-kit/
Now unfortunately, firmware-mod-kit hasn't been updated for a while, but is probably your closest bet. Otherwise, you may want to use the output of binwalk and try to "cut and paste" original and modified sections of the firmware file using the dd. Note that this will likely work only with very simple firmware images, as anything with checksums and sections/file length will have to be modified manually. I was able to make it happen in very limited cases where the firmware was mostly a header with a file system appended to it.