"A only if B" is written symbolically as "A=>B". It is exactly equivalent to "If A, then B", and tends to be used so that symbolic conditionals can be read without having to transform the syntax in any way:
(P & Q) => R
reads correspondingly as
P and Q, only if R
whereas a bit of mental reordering is needed for the rendering:
If P and Q, then R.
The statement "A if B" is written symbolically as "B=>A", and is just a transformation of "If B, A". Naturally, then, the biconditonal "A<=>B" which is equivalent to the conjunction of "A => B" (A only if B) and "B => A" (A if B) can be read as "A if and only if B".
There is some confusion, however, in natural language. You almost never hear "if and only if" in daily usage, because we instead rely on context to express biconditionals. The parents who tell their children "we will go to the sea tomorrow only if it is sunny", formally mean they will go to the sea tomorrow if and only if it is sunny. Indeed, the children would be much surprised if the next day it was sunny, but they were told "just because it is sunny, does not mean we get to go to the sea: that wasn't a biconditional I gave you yesterday, y'know!"
Even in mathematics, context is relied upon when it comes to definitions. For instance, the following is taken from one of my textbooks:
"T is a topology on X if the following three conditions hold: ..."
In fact, the "if" here expresses the biconditional, since the conditions failing to hold guarantees that T is not a topology on X. It is standard in mathematics that in definitions, the biconditonal is assumed unless otherwise stated, likely for the sake of conciseness.
It would seem then that the OP's confusion lies with this natural language understanding of "only if", and the reliance of that understanding on context. But in formal logic, context is thrown out the window, and all connectives are given unique interpretations. So
"A if B", "A only if B" and "A if and only if B"
are mutually non-equivalent, being English versions of the statements "B => A", "A => B" and "A <=> B" respectively.