Hello @mehnaazkhan17 …Yes if you search here on the forum you will get answer to all your questions
Here is one example how you can make a legend from filters it could get you started…its almost the same for line legends…You can create component legend as well Genius Loci had a node for that…
For place legend on sheet i would take a look here Place Legends on Multiple Sheets with Template Legend