How is the $2^\mathrm{nd}$ law of thermodynamics valid? For example, if we have an infinite cylinder fitted with a piston having adiabatic curved walls and a diathermal base. Now, bring the base in contact with some higher temperature body and let the cylinder absorb some heat. After that, we cover the base with an adiabatic material. Then, we let the gas to expand forever, thereby converting almost all of its energy into work by the mechanical motion of the piston. I don't understand why we have to give some heat to a lower temperature body. We can have as much efficiency as we want by letting the gas expand forever.
I wanted to ask one more thing. In my book, while explaining the efficiency of Carnot engine, there is a graph between Temperature and Entropy. The curve is cyclic and rectangular in shape. It says that the engine goes through four states $a,\ b,\ c,\ d$ corresponding to points $(T_1,S_1)$, $(T_1,S_2)$, $(T_2,S_2)$ and $(T_2,S_1)$. So, the entropy increases while going from $a$ to $b$ but decreases from $c$ to $d$. But in the same book, it was written that once entropy has been created, the universe has to carry the burden of it forever or in other words it can't be destroyed. I think that means entropy can't be decreased. Then, what did it decrease from $c$ to $d$? And why entropy can't be decreased. For example, entropy of electrons moving randomly is large but when we apply an electric field, electrons begin systematic motion and hence randomness is decreased. Then, isn't entropy destroyed"
 A: You are doing a common misconception of the second law.
The Kelvin statement of the Second Law says it impossible to have a process whose only effect is convert heat into work. The term "only effect" means that the system must return into its initial state, that is the process must be cyclic. That is not the case in your example.
The entropy does not decrease for isolated systems. When you plot those diagrams for a heat engine you are dealing with a non isolated system. The engine (the system) is in thermal contact with the sources (the surroundings). If you consider engine plus sources as your system, then the entropy never decreases.
A: 
Then, we let the gas to expand forever, thereby converting almost all of its energy into work by the mechanical motion of the piston.

The gas could not expand forever, this does not make sense, I am sorry to say. (Even without the Carnot Engine example). The return stroke of the piston will compress it, driving it towards the cold reservoir.

once entropy has been created, the universe has to carry the burden of it forever or in other words it can't be destroyed. I think that means entropy can't be decreased. Then, what did it decrease from cc to dd?

On the path from c to d, entropy and energy were transferred to the cold reservoir, keeping the entropy of the working fluid as low as possible, at the cost of losing some energy, which is then restored to working fluid from the  hot reservoir. 
Eventually, the machine will stop working, as both reservoirs will be in thermal equilibrium.
A: 
For example, entropy of electrons moving randomly is large but when we apply an electric field, electrons begin systematic motion and hence randomness is decreased. Then, isn't entropy destroyed"

I think you have a wrong picture here.
If electrons don't interact, their initial speed randomly distributed $\bf v_0$ will evolve as ${\bf v_0}+q{\bf E}t$, which as the same statistical properties as the initial distribution because $\bf v_0$ is somehow preserved. The disorder is not changed, the entropy is constant, which corresponds to the field only providing work (and no heat) to the distribution.
If you want to get rid of $\bf v_0$, the electrons need to interact together or with a surrounding lattice. In this case, the energy provided by the field will be redistributed, leading to an increase of the disorder and of the entropy - typically, particles will reach a thermal state with higher temperature.
