Ah ... well ... I guess it would be a lot easier to write down the complete code instead teaching you some lessons ... but I can't do that. ;D
This comprises of three parts:
1. Some method to hook into the "hey the player has clicked a target ... we need some action" machanism.
This "mechanism" is named
Event.
A very good event for this could be
PLAYER_TARGET_CHANGED.
A good start point with handling events could be
this page.
2. Get the value to show
If the value is the targets health this is very simple:
UnitHealth("target")
For all other possible values it is as simple as with the units health. Just see the
Unit Functions.
3. A way to show the value via your addon. But this should be really simple.
If you need further help I'll will be glad to provide it ...
... at least if you report back with some real code.