There are 3 potential ways you can control servos with the Arduino.
I always did the hardcode method just because I like it better. Here is an example of controlling a servo that way
I like to control servos this way because it allow for an explaination of how servos work. A lot of people would advice against this because, among other reasons, it takes up a lot of space. I do it anyway because I like it. I don't know what to tell you about what you tried, but maybe if you supply us with the error, we can help more.
Hope this helped