Punishment will only make your child get even more scared of telling you the truth. When a child lies because of fear, she is refraining from telling the truth to shelter herself from the punishment.
Hence the first thing you must do is never scold or confront your child for lying. Opt for a more moderate line of communication and instead ask her the whole truth. Give her a chance to tell you the truth without fearing or getting scared of you or the punishment. Take away the obvious consequences of telling the truth.