You need to find a written source
As per the Ritual Caster feat's description (PHB, p. 169; emphasis mine):
If you come across a spell in written form, such as a magical spell scroll or a wizard’s spellbook, you might be able to add it to your ritual book. The spell must be on the spell list for the class you chose, the spell’s level can be no higher than half your level (rounded up), and it must have the ritual tag. The process of copying the spell into your ritual book takes 2 hours per level of the spell, and costs 50 gp per level. The cost represents
material components you expend as you experiment with the spell to master it, as well as the fine inks you need to record it.
The way I understand that is you can add rituals to your rituals book, you simply need to copy it from a written source and pay the costs and spent the necessary time.
So, to be very precise, as long as the spell you want to copy is from the spell list you have chosen when taking this feat and has the ritual tag and is not higher level than half your own level (rounded up) and you have a written source for it, then you can include it in your rituals book.
Eg.: You have taken Ritual Caster (Wizard) as a cleric. You find a scroll of detect magic. As a cleric you have access to that spell, can cast it as a ritual but to do so you need to prepare it after a long rest, taking one of your preparation slot for the day. Since it is also a spell in the wizard's spell list, you could add it to your ritual book and from then on you wouldn't need to prepare Detect Magic to be able to cast it as a ritual (and as a ritual only), as long as you have your rituals book in hand.