How to use outlinePass to a line object

I can add the outline effect to a mesh object , but it not works on a line, why?

OutlinePass does not support points and lines because its implementation is only compatible with triangles. Related GitHub issue:

So if I want to add the selected status of lines, are there any alternative methods ?

Have you considered to implement the highlight by using vertex colors?

You need to work with line segments though. If so, you can change the vertex colors of the specific start and end vertices of the selected line segment.