I’ve seen examples of code that uses a p5.svg.js library, but have been unsuccessful in getting any of those examples to work. They seem to either produce errors or corrupted .svg output. In fact, it’s not clear that the library is maintained. Perhaps someone else reading this can provide us with information about that.
If you perform a search regarding that library and find an example that actually works, please let us know.