Generate a python function that takes an array and returns its maximum element.
[5, 25, 10, 9]
def maxElement(arr): 
    max = arr[0] 
    for i in arr: 
        if i > max: 
            max = i 
    return max 
 
arr = [5, 25, 10, 9]
out = maxElement(arr) 
print(out)