I’ve run into this before, assuming someone posting here is about 25 or 30, only to discover they’re 15 or 13 years old. I can only assume you’re a student just experimenting, but you’re taking a wild guess at this, and quite literally everything in this code is out of place. There’s nothing wrong with experimenting, but you’re going to need to take one step back and get some bearings as to what is in the code you’ve posted.
rotation, inside a Transform, is a Quaternion. There is absolutely no use whatsoever using the ‘Z’ component of the quaternion, unless you know quaternion algebra and have some specific intent, which wouldn’t make sense because the Quaternion class does most of that for you.
I wish Unity had built their Quaternion class where members x, y, z and w were inaccessible to user code. I can’t image anyone would need access to them for any reason, because if they did they would very well know what they’re doing.
You need to understand the basic trigonometric rotation formula. Sin and Cosine have no application in the approach I see here. You should start by searching for a few key points and read on these subjects: