It’s pretty difficult for some people to listen to music and write at the same time, but it’s helpful for others.
Music can definitely inspire creativity, but it’s important to pick the right kind of music.. Some forms of music are destructive to the human mind and body no matter what, e.g. all forms of rock music (heavy, easy, medium, hard, etc) and rap.
Other forms of music are very soothing, and will put you in a better frame of mind to work. The calmer classical orchestra pieces fall into this category, as does instrument music featuring instruments such as pianos, violins, acoustic guitars, and flutes.
Try to avoid music that make you more inclined to do a jig than to actually get any work done. The calmer and more relaxing , the better for your state of mind and your writing.