So far I have a script that draws a line from point A to point B:

using UnityEngine;
using System.Collections;
public class Linie : MonoBehaviour {
void Update() {
Debug.DrawLine(new Vector3(-5, -2, 7), new Vector3(3, 5, 10),Color.red);
}
}

It works perfectly fine but I need the line to go through those two points and to be infinite on both sides

I’m not sure if it’s possible, but then again I do not have that much experience.
Do you have to have it infinite, or is it enough that it is shown all across the screen?

If it is enough that the player/camera thinks it is infinite, you can calculate the line from the left side of the camera view edge to point A, and from B to the right camera/view edge.

Else, well, just use really big numbers for the edges?

Well, you could create an equation of the line from A to B, and then calculate it’s position on the positive and negative ends.
You know, y = m*x + n ?
If that’s not possible, then again, have it intercept with the camera view edges (which should have simple linear equations)

I did not know DrawRay is infinite.
If it really is, find a point between A and B, call it C.
Then, like StarManta suggested, draw from C to B, and C to A, that way it goes both ways.