I contributed to a 401(k) for the past three years and due to market volatility there is no gain in my contribution.
That is not surprising as we have had a market crash recently and while there has been some gain in the past three years, most newer investors would have likely seen little or no gain given that their monies were invested over time.
Now you should investigate this further, is this because you made poor investment choices, have high 401K fees, have high fee mutual funds? Your job as a retail investor is to figure all this out and it is unlikely a low wage customer service rep will be of much help and may be prevented to be of much, by law.
An important gauge in all of this is what were your balances at in January of this year? How much gain did you have then?
Its hard earned money. Is it possible to sell all the stocks and bonds
contributed? I am not planning to take cash out due to penalty.
Is it possible to keep cash in my 401(k)?
As others have said in the comments, most 401K plans have money market or treasury bill funds that lead to preservation of capital. However, if you put money in those funds three years ago, you would be in basically the same situation you are now. Those kinds of funds do not grow.
Three years is a very short investment horizon and perhaps you need to really examine your risk tolerance and if you should be contributing to a 401K at all. Assuming you are not near retirement age, you will likely see more situations like this in the future where the market crashes if you choose to remain an investor.
Being an investor, no matter if it is real estate or stocks, takes courage and one assumes risks. This is one of those times. Do you have the courage to continue? Are stock/bond investments suitable for you?