How do you change the material of a plane using a C# script?

I want to set a png image as the material of a plane but the thing is that this png image will change every time the user runs the game. I tried simply setting the plane’s material to the png image the normal way (dragging and dropping) but it doesn’t update every time like I thought it would so I want to run a script when the level is loaded. If someone could point me in the right direction that would be fantastic!

myPlane.renderer.material.mainTexture =