Not as simple,
what the plugin or bot does is take a list of all nearby objects from HB , and filters for various types, including npcs, mobs, gathering nodes, critters, and so on. You can see this list when you open up the development options in HB.
The range of this is quite limited, so you also need to tell HB how to move to a new location, and the navigator in HB will attempt to travel there. Because of a large amount of legacy options, navigation can be tricky business.
Questing, uses QBs that can make the job easier, but it also needs a route to travel around with, and sometimes a series of events to follow, ie going under a bridge, around the world boss, etc.
Code (plugins, bots, profiles) can also gather items from around the area, but it requires tapping into core HB functions that are obtuse and keep changing. Did I mention obtuse?
If you can, stick with the questing system or professionbuddy scripted events, because it can often be as simple as a grind profile inside a quest to gather certain IDs from the area, and moving around until the condition are met, then hearths back when it's done.
Edit: use wowhead data to extract a list of nodes where trees can be found. An editor can add new areas or set up blacklisted areas to not wander near. And/or record their route for later editing and review.
New routes could also be generated using the old in game addon routes, and converted into a gathering path that a grind or quest or gathering bot can use.
Lots of options.