This is how I actually want the output when I execute my HTML file, when I use <table> and <th> tag in the page because I want to show the results beside the form i.e. in the white space.
I would not use tables at all for such a layout. Tables are hard to transform into responsive layouts.
Instead use regular div and style them with CSS accordingly.