If I put an iron nail bear a magnet, a magnetic field would be induced in the iron nail Now, the iron nail becomes a magnet without rubbing or any other energy-consuming process. Now, if I take the magnetized iron nail near other iron pieces, it would attract them and give them kinetic energy. So,  the magnetized iron nail must have got some energy. My question is that when we keep the nail near the original magnet, then, does the original magnet loose some energy to the nail and become less magnetic??  I think this would conserve energy.
 A: The electron spins responsible for ferromagnetic behavior prefer to be aligned with external fields.  That is, the energy of a spin which is not aligned with the external field is higher than the energy of a spin which is.  When you move an unmagnetized piece of iron$^\dagger$ into a magnetic field, then the spins tend to transition toward their lowest energy configuration, they surrender the excess energy to the atomic lattice in the form of vibrations, and the piece of iron gets warmer.
This can be quite counterintuitive, but the general rule of thumb is that if a lower energy configuration is available to a system, then the system will tend to transition towards it, giving up excess energy as heat (or light, or sound, or vibration, etc) along the way.
When you see a small piece of iron file stand on end in the presence of an external magnetic field, it is because the energy of that configuration is actually lower than the energy of the configuration in which it is lying flat.  If the mass of the iron file is sufficiently small and the magnetic field gradient is sufficiently large, then the gain in kinetic and gravitational potential energy is more than offset by the corresponding decrease in magnetic energy (a stronger magnetic fields means a more negative magnetic potential energy for a dipole, $U = -\vec \mu \cdot \vec B$), and so the iron file actually loses energy by moving.
So, where does the iron file get the energy to stand up?  It turns out that's like asking where a rock gets the energy to fall down.  The answer is that the iron file (the rock) already has potential energy by virtue of the fact that it is some distance away from the magnet (the Earth), and there is a tradeoff between forms of energy as the system transitions to a lower-potential-energy state.

$^\dagger$Iron is not the best example, as its temperature doesn't really change much when it is magnetized, but that's not important here.  Gadolinium and its alloys are the best materials to observe this effect; see here for more.
A: You don't necessarily need energy processes like rubbing for turning a iron nail into a magnet. Any piece of iron is by default magnetic, but sometimes small pieces of iron called domains (which are magnetic) do not align in the proper direction.
So the magnetic field of the whole nail cancels out. When you bring the nail near to the bar magnet, the magnetic field of the bar magnet causes all the domains of the iron to align, giving rise to the magnetic field of the nail. So, rubbing is not necessary for making the nail magnetic.
As for whether the magnet loses the magnetism. You must be familiar with induction, in which passing a magnet over a piece of wire causes current in the wire. In that process, there is no loss of magnetic power. Similarly here, you are just re-aligning the domains magnetic fields to point in one direction. You are inducing a magnetic field. so, there is no actual loss of magnetic power of the magnet.
Some magnets do wear off due to heating. This happens because the extra energy in form of temperature causes the electrons of the bar magnet to mis-align (The alignment of electrons in a particular manner causes the magnet to have a magnetic field). This causes he magnetic field to cancel out, thus eventually causing the magnet to lose most of its
magnetic strength.
