If you still want to keep some music then Apple has a built-in setting that you can use to help keep your downloaded music under control/
To find it go Settings > Music > Optimize Storage, and then flip the switch to turn it on and then choose how much minimum storage you’d like iOS to try to maintain on your device.
Once you have selected your desired minimum storage space, iOS will delete music that you have not played in a while off your device to try to hit this target. If you have a ton of music downloaded, this will be easy, if not iOS might not be able to hit the target, but it will still do what it can to help you out.
If you have less than four gigabytes of music downloaded this option will not be available.