how can i creat a auto moving (up and down) c# script ?

i need move a coin up and down auto

This would normally be done using Unity’s Animation system (it’s a bit too big to cover in a written answer but there are plenty of excellent tutorials on YouTube).

If you search for “unity coin animation” you’ll find plenty that use the Unity Animation system to rotate coins but that’s easily adapted to change position instead.