I don't know it is possible to achieve what you are asking because you don't know how to proceed when you pass from a category to another one. I will explain it with an example.
You may try using the Convert points to line(s) SAGA tool from Processing Toolbox: it leads the creation of lines starting from a point layer for which you specify the order for the creation of the line features and how to separate them.
Starting from this point layer:
which stores its ids in the
"FID" field and the categories in the
You may run the above tool by setting the
"FID" field as
Order by... parameter and the
"AUTO" field as
Separate by... parameter.
You will get this result:
which still stores the
"AUTO" field (so, you can still apply the classification).
As I specified above, it is correct that a line is not created when passing from a category to the next one because QGIS doesn't know what to do. Starting from this result, you should, however, be able to add some feature lines with custom values for completing the task.
If you have many elevation values, you may create a new field which stores a classification of them. For doing this, create a new field and then, in the field calculator, use this expression (the following values are an example):
"Altitude" <= 300
"Altitude_range" = 0
"Altitude" > 300 AND "Altitude" <= 600
"Altitude_range" = 1
"Altitude" > 600 AND "Altitude" <= 900
"Altitude_range" = 2
"Altitude" is the field in you point shapefile which stores the altitudes and
"Altitude_range" is the name of the new field (adapt the name and the code to your case).
The following image will help to undestand: