/script SendChatMessage(UnitClass).." health is, ("say")
This line does not contain any valid command. You can try
/script SendChatMessage(UnitClass("target"), "say")
to get your primary class. Or
/script local p,s = UnitClass("target");SendChatMessage("Primary class is " .. p .. ", secondary class is " .. s, "say")
for both primary and secondary.
You don't have to take macro as divine revelation beyond comprehension of mortal people. This is just some text a fellow player wrote. It's easy to parse them once you get the idea. Let me give you some examples. Btw /run and /script are almost equivalent so I will you use the former.
/run SendChatMessage(123, "say")
/run SendChatMessage("any text i want", "say")
Here SendChatMessage is something which is called function and you pass it comma-separated parameters. As you an see, it just prints the first parameter in the white chat. String parameters can be merged into one using two dots ..
/run SendChatMessage("first " .. "second " .. "third", "say")
In your examples UnitName("target"), UnitLevel("target"), UnitHealth("target") are all calls of other functions (and yes, "target" is the only parameter here).
Now try looking at your macro again and decompose it into something you already know.
Next, few tips about Walu Village dailies. I believe ctrl+tab is the default shortcut to target the nearest friendly object or the next one if you already have selected something. This includes both players and NPCs. Of course enemy players in SW are not considered friendly. This is exactly what TargetNearestFriend() does. Btw some functions can be called without parameters like this one.
If your macro for treating mushrooms contains only of those three lines then you can simply omit the last one. Delays are needed only when you want subsequent commands to be execute after some delay. For example, you can duplicate those lines.
/run TargetNearestFriend()
/run UseItemByName("Batchie Grass")
/wait .5
/script TargetNearestFriend()
/run UseItemByName("Batchie Grass")
Will treat two mushrooms with one macro call. Add more for less clicking.
Quest taking and delivering can be automated as well but let's leave this for another time.