To create a new polyline in QGIS:
Layer > New shapefile layer
Select line as geometry and set the name for the layer, e.g. test. At this point, you can assign attributes to the line. We'll create only one attribute as an example (line's name), and it will be string type:

Now, click on the pencil icon at first and on the line icon afterwards:

When you finish to draw, do a right-click, and you'll be able to configure the line attributes.

To edit a line, click on the pencil first and on the edit icon afterwards:

Now you can select the point that you want to edit. If you click on the +, you'll be able to extend the line:

Hi, I'm Erik, an engineer from Barcelona. If you like the post or have any comments, say hi.