I'm trying to save all data of a game(like when you save a game) but for this game you need to save a gameobject to a prefab using a script to do it. And the other thing is to save data of the variables. if some one can help me please.:)
In the Unity runtime (so outside the editor) you can't dynamically generate new prefabs (you need UnityEditor classes for that). GameObjects and their script data are serialisable so you could serialise their state using a script that enumerates over all gameobjects in a scene. To help you started on serialising gameobjects take a look at:
http://www.unifycommunity.com/wiki/index.php?title=Save_and_Load_from_XML