You can have a look at Wikipedia article about betting exchanges for more details on what backing and laying actually means. Notice that to make profit, laying odds have to be lower than backing odds. (Laying odds say how much you have to pay out.) So in the situation described in your post you would be losing money.
In everything I write below I will use decimal odds.
Laying as usual betting. Laying means that you behave like a bookmaker. I.e., you accept bet from another user of the betting exchange. Other than that, it is basically betting on the opposite outcome but with different odds. Namely if the odds are $o$ and if the amount is $b$, laying means that you accepted somebody's bet with odds $o$ and they wagered amount $b$.
- That means that you are risking $bo-b$. (This is the amount you have to pay out if you lose. The other player wagered $b$ so he has to get $bo$. We subtract the amount he wagered himself.)
- Let us denote commission by $c$. If you win, the other player pays $b$. After subtracting the commission, your profit is $b(1-c)$.
- The total winning (i.e., winning+risking, profit+wagered) is $b(1-c)+b(o-1)=b(o-c)$.
- The ratio between total winning and risked amount is $(o-c)/(1-c)$.
So if you prefer to think about laying this way, it is the same as the usual betting, but you have to modify the odds to
$$O=\frac{o-c}{1-c}.$$
You can find information how to calculate profit for complementary events here: How is potential profit from an arbitrage bet (a.k.a. surebet) calculated? (sports.SE).
This calculator. Let us check what you actually calculate in the linked calculator.
With one bookmaker, you have wagered $b'$ for odds $o'$, so there you stand to win $o'b'$ or lose $b'$. The situation with the betting exchange is analysed above.
You want to maximize your profit, which means that possible win (including wagered amount) is in both cases the same. That means
\begin{gather*}
W=b(o-c)=o'b'
\end{gather*}
From this you get
$$b=\frac{o'}{o-c}\cdot b'.$$
This means you are wagering (risking) $B=b'+b(o-1)$.
The total profit will be $W-B$.
In your case $b'=20$, $o'=3.2$, $o=3.2$, so you get
$$b=\frac{3}{3.2-0.05}\cdot20 \doteq 19.05.$$
Google calculator
In the case of either outcome, total winnings are $o'b'=60$. But after subtracting $B=b'+b(o-1)=20+19.048\cdot2.2 \doteq 61.91$ you see that you are actually
Google calculator loosing around $1.91$.
To summarize once again in numbers what was described in symbols above:
- One possible outcome is that you win $3\cdot 20=60$ in your original bet. Your profit here is $60-20=40$. (You originally wagered $40$.) But in the other one you have to payout $2.2\cdot19.05=41.91$. So you lost $1.91$.
- The other possibility is that you lose $20$. In the betting exchange you won $19.05$. But after applying the commission, it is only $19.05\cdot0.95\doteq18.10$. So you are still losing $1.90$.
In fact, the amount you are losing (or winning) should be the same in both cases, the difference above is due to rounding errors.