Develop a function in Python that takes a string as input and finds a pattern in it and replaces it with a given set of characters.
"abcabcabc", "abc", "xyz"
def replacePattern(string, pattern, replacement):
    return string.replace(pattern, replacement)

result = replacePattern("abcabcabc", "abc", "xyz")
print(result)