I am trying to add a gradient (in the lines not as filling in the shapes) from one side to the other in the artwork attached. When trying to add this gradient, Illustrator adds a gradient to each stroke individually. I want a gradient done to the entire piece as one whole. I did try to Object > Path > Join, to make the work as one. However this adds more random lines to the artwork, destroying the work.
One option is to use a compound path. Simply select all your lines and go to "Object → Compound Path → Make" or hit cmd+8.
Your individual lines with a gradient stroke applied:
The same lines converted to a compound path:
Another option is to use the Appearance panel (Window → Appearance) and apply the gradient stroke to a a group or layer containing the lines:
Trying goint to Object>Expand, then in the popup window click both "Fill" & "Stroke" and click ok. Then go to Pathfinder and click Unite. If you don't see your Pathfinder window got to Window>Pathfinder. Hope that does the trick.