Problem scenario
You have a collapsible bicycle (for commuting in a big city), and the handle bars have play in them. What should you do?
Solution
Verify the mechanism for securing the bike in "riding mode" is in place. Some folding bikes have latches that help secure the handle bars in place. If you forgot a step like this, there could be play. This play is a concern if it has had a previous owner or is an older bike.
If you are not 100% sure that there is movement, try extending the handle bars to a higher than normal point. Then ride and push around on the handlebars to see if there is movement. This puts more torque on the handlebar assembly with the stem elongated. This is a sanity check, but with higher handle bars (as folding bikes usually have adjustable height handlebars) can help pronounce/exaggerate the movement in the handlebars themselves. You want to confirm that the movement is real unless you know there is movement that shouldn't happen. This is a very bad sign.
We strongly recommend you take your bike to a bike store to have it looked at by a professional. Even then if the hinges are worn there may be no tightening they can do. Some bike mechanics may think that tightening is only done with newer hinges; this is not necessarily true for older and newer folding bikes. The shaky handlebars could be from something other than the hinges. There can be a component relatively invisible in normal use -- even during the folding down process -- that is the culprit. The lateral movement or lack of stiffness (aka "play") is a very bad sign. We recommend not riding such a bike. Some people don't think affordable new folding bikes are worth the money, but these bikes can be cheap bran new without worn hinges or corroded interior components. Other people recommend used bikes that are from a high quality manufacturer if your budget is below $400-$500. Unfortunately used bikes that are old can have play in the handle bars and the handlebars can break when you are riding. It can be catastrophic. The free movement of the handlebars is the last warning sign before they can suddenly brake off. Your best best is to buy a new folding bike -- even a cheap one -- before risking such an accident.