<s>[INST] Write a function to output all prime numbers within a range
Input: two integers to define the range [start, end]
Output: a list of prime numbers found in the range

Example:
Input: [20, 50]
Output: [23, 29, 31, 37, 41, 43, 47] 

Here is my attempt, which does not seem to work:
```
def primeInGreaterOrEqualRange(number):
    if number > 1:
        for i in range(2, number):
            if (number % i) == 0:
                return False
        else:
            return True
    else:
        return False

def getPrimesInRange(start, end):
    primeList = []
    while start <= end:
        if primeInGreaterOrEqualRange(start):
            primeList.append(start)
        start += 1
    return primeList

print(getPrimesInRange(20, 50))
```
I appreciate your feedback on this.

1.  There seems to be a logical bug in the `primeInGreaterOrEqualRange` function.

2.  I am concerned about the efficiency of this program.

Do you have any recommendations, or better ways to do this?[/INST]