Python draw 2 vertices under specified angle EDIT!
As far as i understand you seek for this. one way to do this is using the matrix.Rotation
the only thing i dont know and maybe @batFINGER or @Robin Betts can help in this is to extend the line to the asked X axis. As far as i get it @cexoso wants to "constrain" the vertices on the X axis. with other words the vertices are free to move on the Y axis and are fixed on the X axis respecting the given angle.

@batFINGER or @Robin Betts
May i ask you to edit this code so that the line will be extended on both sides to the X axis. I'll try to explain using an square. Screenshot is below the code.

Please note that in this example the outside vextors are drawn on -1.0 and 1.0 X axis
I added a third vector but it might not be needed. 

import bpy
import bmesh
import mathutils
from mathutils import Vector
from bpy.types import Operator
from bpy_extras.object_utils import AddObjectHelper, object_data_add
from bpy.props import FloatVectorProperty    
from mathutils import Matrix
from math import asin, pi, degrees, radians


angle = 10
mesh = bpy.data.meshes.new("mesh")  # add a new mesh
obj = bpy.data.objects.new("MyObject", mesh)  # add a new object using the mesh

scene = bpy.context.scene
bpy.context.collection.objects.link(obj)  # put the object into the scene (link)
bpy.context.view_layer.objects.active = obj   # set as the active object in the scene
bpy.context.active_object.select_set(state=True)  # select object

mesh = bpy.context.object.data
bm = bmesh.new()
test = [] 

V3 = bm.verts.new((1, 0, 0))
V2 = bm.verts.new((0, 0, 0))
V1 = bm.verts.new((-1, 0, 0))

bm.edges.new((V1, V2))
bm.edges.new((V2, V3))

bmesh.ops.rotate(   
    bm, verts=bm.verts, matrix=Matrix.Rotation(pi * angle / 180, 3, 'Z')) 

bm.to_mesh(mesh)  
bm.free()  # always do this when finished


Text continues below screenshot



Note 1 
On any given angle the edge should connect to the square
I dont know how to do this tbh. Im still learning lOL 

Hope my answer contributes to this question