Creating own ciphertext after a padding oracle attack? I've written a script that breaks a cipher text based on a padding oracle for an assignment, but was wondering how I would continue on to create my own cipher text with any plain text I desired?

Someone on the class forum mentioned XORing the intermediate step (or the $D(C_i)$ before XOR with $C_{i-1}$) (taken from the process of breaking the original cipher text) with the plain text of my choice to generate $C_{i-1}$. I don't see how this works, or if I misunderstood what the poster was XORing together. I see how $D(C_i) \oplus C_{i-1} = P_i$, but not sure how you can use your own plain text in that way.

I'm looking for hints on how to approach this, or a clarification on the 2nd paragraph.
You should be able to generate a ciphertext for any given plaintext using a padding oracle attack if you are using CBC mode. You'll need to be able to  modify the IV though for it to fully work.

This is because every time you scramble an earlier block, you can just fix it by modifying the cipertext for the block before that (or the IV for the first block). If you can't modify the IV you are stuck with being able to modify all blocks except for the first (and the first one will become garbage).

The idea is to start from the end, and create a random ciphertext block $C_n$ (this can be fully random, a set of zeros, or any particular value you desire). When you then use the padding oracle attack against this block, you'll receive the decrypted value of this block: $\operatorname{Dec}(C_n)$ (as that is what the padding oracle can do for you: decrypt any ciphertext you pass into it, no matter whether it's valid or not).

Note, that $\operatorname{Dec}(C_n)$ will be garbage, but, since you are using CBC mode you can modify the preceding block $C_{n-1}$ in a way so it will actually XOR $\operatorname{Dec}(C_n)$ to your chosen plaintext $P_n$: $C_{n-1} := \operatorname{Dec}(C_n) \oplus P_n$.

Once you're done, continue the steps. You already know $C_{n-1}$, calculate $\operatorname{Dec}(C_{n-1})$ using the oracle, and then set $C_{n-2}$ so the CBC mode will XOR it into $P_{n-1}$, etc.

The only problem is with the first block. If you have access to set the $IV$ then it's not a problem, you just make sure the $IV$ is set to a value so it will XOR $\operatorname{Dec}(C_1)$ into $P_1$. Otherwise you are stuck, and you have to keep the first block as garbage.

See also https://crypto.stackexchange.com/a/50027/34606