My first piece of advice is to get rid of all the [Update] business. Write a coherent question that makes sense to someone reading the whole thing for the first time. Put the actual question at the top.
I went to your question to edit it a little - some
backticking around inline code, a blank line before a code block so that it would format properly - but I didn't get far. I did find a line that said vaguely "I get error messages" and later an [update] that said what they were, so I brought the error messages up to where you said you get them and deleted the [update]. But then I ran into trouble.
When you solve one problem but then something else happens, don't keep adding more and more story into your question. Leave the first one alone - for example, it was a duplicate of something, fine, let it be closed as that - and ask a fresh one. When you get that solved, accept the answer for that one and if you now have a third problem, ask that as a separate question. Updating the question as drastically as you are invalidates old answers and frustrates people.
We've talked about this on Meta before: take a look at
Exit strategies for "chameleon questions" and Guidance To Avoid Chameleon Behavior and see if you recognize your behavior. It's a great sign that you have come here and asked for advice. This particular aspect of SO culture is a little unusual.