You can also use the pencil tool to draw straight lines by holding the Option key (mac) or the Alt key (windows). If you are drawing many shapes which you want to fill with a color, this options box also has a check box to automatically fill drawn paths with color.
As you can tell, the smoother setting adjusted the path much more. Here are two lines, one drawn with fidelity all the way up to “smooth” (seen on left) and one with fidelity all the way down to accurate (seen on right), meaning closer to what you actually drew with the tool. If you double click the pencil tool icon in the tools panel, you can view the options for the pencil tool’s fidelity. The pencil tool will automatically adjust the lines you draw to make them look smoother. In this example, I created a rectangle with the rectangle tool, selected it, and then drew an addition to the top of it with the pencil tool, starting at the upper left corner of the rectangle path. This effect can also be applied to other shapes, which can be incredibly useful in altering shapes you created with the pencil tool or preset shape tools. In this example, the pencil tool is used before the end of the original line. This will reshape the line into the direction of wherever you began drawing you line. You can also begin drawing along any other point of the line and do this. Make sure the first line you drew is selected with the direct selection tool and then begin to draw along the end of the original line with the pencil tool to extend it into a new direction. If you draw a line and would like to extend it or alter it, you can join a new line to it. Alter it in the stroke panel while your path is selected to get a thicker or thinner line. If you do not see any lines after unclicking when you are finished drawing, the stroke may be set to zero. Select it from the tools dialog box and click and drag to draw. The pencil tool is a great tool for creating freeform shapes and lines in Adobe Illustrator.