Ok, here is the problem.

Could someone tell me how to address the servo within a function ?

void loop() 
{ 

  myservoA.write(180);
  myservoB.write(0);

"loop" is a function.
You seem to be addressing both servos adequately within it.