Method for forming barrier layer in semiconductor structure