How to set a material to game object using script

I create a gameobject in script and try to set red color material using script.
I can see the mesh but its in pink color not the material.How to achieve this?

Code

GameObject gmo=new GameObject("GO "+io);
gmo.tag = "Player";

Mesh mesh = new Mesh();
mesh.vertices = vertices;
mesh.triangles = indexes;
mesh.RecalculateNormals();

MeshRenderer meshRenderer = gmo.AddComponent();
MeshFilter meshFilter = gmo.AddComponent();
meshFilter.mesh = mesh;
meshRenderer.sharedMaterial = red;

What is red? This is attached by inspector? If so, please check the material to be correct or not. I think that the red material is wrong. the pink color indicate a shader error. (We hate the color because a shader doesn’t work well :/)