First of all format your code using the <> button so it's easier to read.
I'll lay out the general idea. Start at the input number + 2 (assuming the input number will always be prime, not sure from your description). Call a function called is_prime() that determines if the number is prime or not. If not, increment the input number by one and repeat the loop.
is_prime() will work like this. Set i = 2. While i * i < input, check if (input % i) ==0. If it does, then return false. If it doesn't then return true.