Elliptic curve scalar point multiplication
For adding, subtracting, and multiplying modulo 29, you can just do the operation in the integers and take it modulo 29 (as you're already doing). To find $a/b$, however, you need to use the extended Euclidean algorithm to find the inverse of $b$ modulo 29, then compute $a \cdot b^{-1}$. This StackOverflow post has pseudocode for the extended Euclidean algorithm. Your mistake is trying to use ordinary division to compute temp.

Multiply $3x^2 + a$ by the inverse of $2y$ to compute temp in your code and you should be good, at least if your goal is to multiply $P$ by 2. If you want to add distinct points, you need to compute $\lambda$ with a different formula, but the rest is the same; if you want to multiply by something other than 2, you should implement something akin to exponentiation by squaring.