Your gradient isn’t showing because by default SVG gradients use 'objectBoundingBox' coordinates, meaning y1=0 and y2=0 collapse to nothing. To fix it, set gradientUnits="userSpaceOnUse"
so the gradient uses actual SVG coordinates. Then you can keep y1="0" y2="0" and get a proper horizontal gradient along your line.