You're very close. Two things I notice: first, the names of the field groups need to be global variables to be accessible in the call to queryInput in the button command. Also, you should close the window in the queryInput proc.
There are an example or two of this in MEL Scripting for Maya Animators in the section on custom dialog boxes, by the way.
-- Mark