Global forecast systems(GFS) gives analysis and forecasts at different time steps. Their main source of input is upper air data which is recorded only twice in a day(observation comes at 00 and 12). But analysis step which incorporates the observations is done at 00,06,12,18 hrs. How is that ?Is my basic understanding understanding completely wrong?
You are right that upper air soundings are typically only done twice a day, and even at quite a coarse observation spacing.
And that upper air data is definitely very important in models.
I'd suggest that, firstly, it's important to note that even a broad, very hazy picture aloft really helps a great deal at the surface. That can be seen in the quasigeostrophic omega equation. Basically the large-scale highs and lows and jet streaks drive much of the vertical air motion in the atmosphere. Plus there aren't quite as many complexities caused by terrain/ground cover/moisture/differential heating that the surface layer sees. So because the evolution of those large-scale features is pretty straightforward over the course of a day, the early morning's upper-level forecast is still quite reliable and helpful 6 hours later.
But that said, smaller scale shortwaves and vorticity maxima are absolutely vital to weather forecasting too. And with smaller size and more transient nature, neglecting their changes over 6 hours is likely to really harm forecasts when it comes to critical subtle differences such as you'd see in a tornado outbreak or hurricane track.
So indeed, how DO we recognize those changes?
Well, we do have a second source that these days is probably at least as important as soundings, perhaps even moreso - satellite imagery.
See for example this satellite page. You can turn on HDW-low, HDW-mid, HDW-high. As far as I understand it, the models are ingesting that information readily (and likewise cloud coverage, which are just as important). I believe some satellites also have vertical temperature sounders that are used more now as well.
And third, we also have some other data sources that help. In certain parts of the world, we've got radars. I believe at least some of the better models these days are using that data... there's plenty of wind data to be had from velocities (though it would seem challenging to use/analyze it given things like range-folded velocities and the ambiguity of tangential winds see the intro to [this article]).
Plus, I believe at least the ECMWF has had real success in ingesting ACARS... atmospheric data that are generally reported by all commercial aircraft.
But... all that said, your point still has some real potency. Especially when we note that, when it comes to our best model, the ECMWF... it still only runs twice a day. Maybe other reasons drive the decision, but you'd think they still weigh how improved such forecasts are. So it seems fairly likely that they've determined that long-range forecasts don't improve much when they are still based heavily upon that older information.
But then, I think everyone would agree that having hourly models available like the HRRR is very useful in important nowcasting situations, such as severe weather awareness. So maybe the overlooked small data changes are (counterintuitively?) more important to long-range forecasting than short-term. Definitely an interesting question you've raised!