How can i Create and set a Matrial to Object

Hi , i have a object, and i want to create and set a material and texture to Element[2] of this object(MeshRenderer) , how can i do this ?

Maybe I don't unterstand your question right, but chances are good that either this or this might help you. These snippets from the official docs show you how to assign material by script and create a material on the fly.