Give a context-free grammar

We know that $L$ = { $w$ $in$ {a, b}* $|$ $|w|_{a}$ > $|w|_{b}$ }

This is my answer: $G$ = ({$S$,$A$,$B$},{$a$,$b$},$R$,$S$)

$R$ = S $to$ $AB$

$A$ $to$ $aA | Aa |B$

$A$ $to$ $a | abB | Bab | Bba |aBb|bBa $

But after testing, it seems that writing like this is wrong.

So how should it be written?

https://web.stanford.edu/class/archive/cs/cs103/cs103.1156/tools/cfg/

This link can be used to simulate.