If and only if, also known as "iff" for short, is a way of saying two things are connected to each other. Just like how you need to have both a key and a lock to open a door, if and only if means that you need both sides of a statement to be true for the whole thing to be true.
Let's say you have a rule that you can only watch TV if you've finished your homework, and you can only go outside to play if it's sunny. If someone tells you "You can watch TV if and only if it's sunny outside," that means that you can only watch TV if two things are true: you've finished your homework AND it's sunny outside. If it's sunny but you haven't finished your homework, you can't watch TV. Or if you've finished your homework but it's cloudy outside, you still can't watch TV.
"If and only if" always goes both ways - it's not like a regular "if" statement where just one side needs to be true. If you say "A is true if and only if B is true," then you can also say "B is true if and only if A is true." They're like two sides of the same coin!