I want to understand if RE a∗ba∗ab∗ is same as the following the finite automata. The Part where I am confused is that, From state 3 to state 4 , there is a b , which means that the language needs to have a b at the end , while the RE just has b* which means 0 or more b . If not what is correct finite automata for this RE ?
Indeed, the regular expression a*ba*ab*
is not equivalent to the DFA shown for exactly the reason you stated in your question.
Thompson's algorithm is a standard way of systematically converting a regular expression into an NFA. (If you need the finite automaton to be deterministic, you can then run the subset construction.)