hi i have query is how can i generat 400hz, 9v, square wave
So you specifically went to the trouble of typing "No subject" as the Summary (or title) of your post??!
Easy. About the same way you would create a 399Hz 8.7V square wave. Unless, of course, you want to form your 400Hz by frequency-scaling from 50Hz mains.
i have query is how can i generat 400hz, 9v, square wave connect a wire to a 9V battery 400 times a second
Erik
YES, you are getting ridicule. WHY do you think it is so? could it be because you took no time to explain HOW. (preferred micro, power available, and - most important - what you have done so far. NO one here will, for free, do your work FOR you, but many will work WITH you. if "help to do it yourself" is not sufficient, hire a consultant.