Laser beam script tracks two objects positions problem

I have two space ships , both are moving in space, I want to create beam like effect between these ships, but I get error (NullReferenceException: Object reference not set to an instance of an object) And I have Transform - laser beam prefab that I want to use as beam, this (everything) works well if this is on script attached to ship, but I need to create them in runtime (I cant have prepared objects on scene, or track them all, just want to create laser, give him 2 objects between whose it will resonate and script on this laser beam will destroy itself after certain time)
So what am I doing wrong , how can I give Script on Laser beam(line renderer) two references on objects to track their positions properly?

//code creating/triggering laser
actual_laserBeam = ((Transform) Instantiate(laserBeamPrefab, _pos, direction_with_inaccurency)).GetComponent<LineRenderer>();
actual_laserBeam.SetWidth(10,10);
_LaserBeam my = actual_laserBeam.GetComponent<_LaserBeam>();
my.start = new GameObject(); //here comes aforementioned error
my.end = new GameObject(); //here comes aforementioned error

//new GameObject is used only as an example, because error happends always

//and...


using UnityEngine;
using System.Collections;

public class _LaserBeam : MonoBehaviour {
	public GameObject start;
	public GameObject end;
	private LineRenderer lineRenderer;
	// Use this for initialization
	public void nastav(GameObject _start, GameObject _end) {
		start	= _start;
		end		= _end;
	}
	void Start () {
		lineRenderer = GetComponent<LineRenderer>();
		lineRenderer.SetWidth(10,10);
		Destroy(this,3);
	}
	
	// Update is called once per frame
	void Update () {
		lineRenderer.SetPosition(0,start.transform.position);
		lineRenderer.SetPosition(1,end.transform.position);
	}
}

I’d try Raycasting and then transform based on hit collider like the following:

if (hit.collider.gameObject.CompareTag(“Ship”)){
selected = hit.transform;

Then call an instantiate on hit.

Hoeloe you were right. I did not have that properly linked within the GameObject. I would swear I put it in there, checked everything ten times except that, my big mistake, thanks a lot.

Thanks for help ShadowK but I got that on another script that is used for targeting.