To directly insert the result of any hive query into HDFS file, try this command:
INSERT OVERWRITE DIRECTORY '/output/path/dir' SELECT * FROM table WHERE id > 100;
You can refer the following video tutorial which will clear all your doubts regarding Hadoop: