how to add material to LineRenderer component from script (js)

Hello
i want to use (for example) Sprites-Default material in LineRenderer component that is created dynamicly from script.
heres the code to function that spawns specific gameobjects that contain LineRenderers:

 function spawnLanes(x1:float,y1:float,z1:float,x2:float,y2:float,z2:float,skala:int){

var lanecaster = new GameObject();
	lanecaster.transform.position = Vector3(x2/skala,y2/skala,z2/skala);
	lanecaster.name = "Lane:"+x1+" to "+x2+".";
	lanecaster.AddComponent(LineRenderer);
	lanecaster.GetComponent(LineRenderer).SetPosition(0, Vector3(x1/skala,y1/skala,z1/skala));
	lanecaster.GetComponent(LineRenderer).SetPosition(1, Vector3(x2/skala,y2/skala,z2/skala));
	lanecaster.GetComponent(LineRenderer).SetWidth(0.02,0.09);
	lanecaster.GetComponent(LineRenderer).SetColors(Color.red,Color.green);
	
	lanecaster.tag="obiekt_generalny";
	lanecaster.tag="obiekt_lanecast";
	
}

i assume that missing thing should be something like:
lanecaster.GetComponent(LineRenderer).material =
but i have no idea where to point it.

thanks

LineRenderer inherits from Renderer so it will be the renderer component on the game object that you attach the script to. You can just do:

renderer.material = someMaterial;