You will lose every spell that you spent training points to get, including any off-school spells and astral spells.
Spells that are from your own school, that dropped from a boss or from a crowns pack, or that you crafted, will remain in your spell book.
When you sell back trained spells, you will lose all of them. In the case of Astral spells, you have to retrain all the lower ones before you can get back the highest one you were most recently using. If you're high level, that may mean backtracking through the Spiral looking for obscure spells that you may not remember where you got them from.
It helps to take a screen shot of your spell deck that you use most often before selling back, so you can get the names of spells you use regularly.
if i buy back training points, do i lose the spells i received from loremaster?
Basically, all loremaster's spells, other spells that could get from pack, and crafted spells cannot be lose from your spell deck if you're buy back your train points. So you don't have to worry about that. Your spell will be and always be there.
I wouldn't think so because those spells count as loot or a crafted item (depending on how you chose to go about obtaining them). That and you didn't use training points to receive them, like I said you either looted them, or crafted them, or got them from a pack.