What you're trying to do is, to the best of my knowledge, not possible. There is no "append" operation on S3 objects — once an object has been uploaded, it's treated as a constant.
From what I'm reading, the task you're trying to perform here would be best accomplished using a database. It might be possible to do it using S3 by creating a separate object with a unique name for each set of lines that you're trying to append, but dealing with all of those objects will rapidly become difficult.