You could and it does make it even simpler (one button does it all) but I recommend against it. You would have to trust the undercut value. Because it also does a scan for the item when you alt click you can see that quite often there will be someone artificially lowering the item price in hopes to drop the price and buy it cheaper. Say some herb usually sells in stacks of 20 but the price for a single unit is 40g, which can go unnoticed (if no add-ons you'll only see the full price of the stack, not by unit) . Someone can easily pick one unit of that herb and post it at 20g or less.
Cooking benefits all classes, especially melee and hunters (it is a free source of food). Until higher levels, the benefits it provides are almost exclusively stamina buffs. While more stamina is always nice, cooking is not essential to leveling. Considering the time investment required, if you pick up skinning then cooking would absolutely be a wise skill to level prior to hitting your level cap, as beasts often drop meat useful for skilling up.
The World of Warcraft API has a list of functions that you can interact with and to talk with WoW using Lua. These are your building blocks for manipulating WoW windows and chat boxes and so forth. Looking at these for the first time can be very daunting. But don't be discouraged. After getting more familiar with Lua the WoW API gets much easier, and the documentation gets much easier to read. Keep in mind there are many different ways to accomplish your goals, so when going though the API keep looking until you find a way that best suits what you need.