It's very simple and easy
step 1: Draw the path.
step 2: Ensure that the stroke color in tools panel is activated. ( press X to change between stroke and fill )
step3: press ctrl+F9 to open gradient panel
step 4: Select your gradient type and options. ( you can also use a gradient color in your color swatches. )
IMPORTANT: If you apply a gradient to a stroke in Illustrator and save document as eps file extension, corel X6 can't read this correctly.