You can use SQL to create a virtual layer.

<!-- language: lang-sql -->

    select 	row_number() over() as new_id, 
    		a.id as a_id, 
    		b.id as b_id, 
    		setsrid( make_line(a.geometry, b.geometry), 3006) as geometry
    from myPoints as a
    join myPoints as b
    on st_distance(a.geometry, b.geometry)<10000
    where a.id<b.id

The query joins the layer to itself where there are other point within 10000 distance units, where their ids are different, then creates a line between them.

You need a unique id column, my is named `id`. Replace `id` in `a.id` and `b.id` with the name of your id column. Replace `3006` with your coordinate system code,  `myPoints` with your point layer name, and `10000` with a distance large enough to include all points (i.e larger than the max distance between the two points farthest apart)

[![enter image description here][1]][1]


  [1]: https://i.sstatic.net/M6db66gp.png