Because there is no deterrence if no one knows about it.
So why not wait until you have it? A poor, poorly developed country isn't going to make rapid, steady progress. If you look at the history of NK nuclear and missile testing, it is littered with many examples of embarrassing, dismal failures. Not having a proven, established and impressive track record in developing a state of the art arsenal is not a deterrent, either.
So they bluster and behave is if they have made that progress, in order to put doubt into minds of others. That, and along with their oversized (for a country with their population and economy) conventional military forces so close to South Korea has to substitute for actual objectively dangerous deterrence until they can get the real thing in place.
What seems to be real is the paranoia they have that South Korea and the USA are just itching to invade and conquer. They also know that, even if they could inflict damage, they could not withstand a military fight with the USA. Though we can play "chicken and egg," being named as part of the "Axis of Evil" by the leader of the lone military super-power in the world, shortly before he invaded one of the other members of that club, probably only helped to confirm (along with the less dramatic but steady rhetoric from the US side of the back and forth), in their eyes, the threat from the USA. Hence the need for deterrence.
Think about the big, powerful dog and the tiny, fluffy dog when they meet in the street. Which one is making the most noise and usually acting aggressively? Usually the smaller one. It's a pretty normal behavioral reaction, when fearful, to try and bluff the larger opponent through exaggerated aggressiveness.